I am constructing a function for retrieving records from a mysql database
and putting them into an array called $print_field[name][number].

My problem is that I only seem to get the first two records and I think I
know where the problem is, but I canīt seem to be able to solve it.

Any ideas anyone?

<?
function print_query_array($query, $fields) {
 global $print_field;
 global $linkid;

  // Determine what fields are selected
  $field = explode("|",$fields);

  $mysql_res = mysql_query($query,$linkid);

  while ($strow = mysql_fetch_array($mysql_res))


   $print_field[$field[0]][] = $strow[$field[0]]; // Problem
   $print_field[$field[1]][] = $strow[$field[1]]; // Problem
  }
}

print_query_array("SELECT field1, field2 FROM table LIMIT 10",
"field1|field2");

for ($i=0; $i<sizeof($print_field); $i++)

 echo $print_field["field1"][$i]."<br>";
 echo $print_field["field2"][$i]."<br>";
}
?>

Thanks,
// Tobias





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to