Welcome Guest, Not a member yet? Register   Sign In
for loops in model that return an array
#1

[eluser]face1m[/eluser]
Greetings forum:
I am trying to convert some php code to the mvc.
Here is the code:
<?php
for( $i =1; $i <= 39 ; $i++ ) {
$result = mysql_query( "select count(*) from pball where pball =" . $i );
$count = mysql_result($result, 0);
$pball[$i] = $count;
}

?&gt;
This makes a repeated query to the db for the total count of number $i. Afterward the for loop completes I would like to return an array.

I figure the above code goes in the model and called by the controller.

I am stumped. I am new to codeigniter and mvc. I'm thinking there is an easy solution, but its hard hitting for me. thanks in advance.

rick mcelderry


Messages In This Thread
for loops in model that return an array - by El Forum - 02-08-2010, 04:46 PM
for loops in model that return an array - by El Forum - 02-08-2010, 05:49 PM
for loops in model that return an array - by El Forum - 02-08-2010, 07:17 PM
for loops in model that return an array - by El Forum - 02-08-2010, 07:24 PM
for loops in model that return an array - by El Forum - 02-08-2010, 07:26 PM
for loops in model that return an array - by El Forum - 02-08-2010, 07:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB