Hi to all:
I'm stuck battling to get the values of certain columns of a query and getting into an array to manipulate on some ways:
I have this piece of code:
$query = "select Frec1,Frec2,Frec3,Frec4,Frec5 from $database where Category=\"$Categ\" and Province =\"$Prov\" order by $param ";
$datos = mysql_query($query);
$numreg = mysql_num_rows($datos);
// Since we know the numbers of rows returned, we know the max number of items. The max number of values is between numreg and maxitems
$maxitems = $numreg*5;
// Now comes the source of my probs...
while ($myrow = $numreg) {
$pass = 0;
$numitem = 1;
// Frec1 - Frec5 are the colums object of the query.
$key = "Frec1";
while ($numitem < = $maxitems) {
$frec[$pass]=$myrow[$key];
// If key is Frec5 we're at the end of the row
if ($key == "$Frec5") { $key = "Frec1";}
// Change the contents to Frec2, Frec3...
$key++;
// Increment by one the value of numitem
$numitem++;
// Increment by one the value of pass
$pass++
}
}
Where's the bug on the 'fountain of probs', I'm stuck here and I don't see the problem.
sizeof($frec) returns me 0 as number of items.