Why doesn't this function do't return any row?
function select_mysql($tabel, $order, $volgorder, $statement) {
$iCount = 0;
$rows = array();
$query = 'SELECT * FROM ' . $tabel . ' ' . $statement .
' ORDER BY `' . $order . '` ' . $volgorder . '';
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {
while ($property = mysql_fetch_field($result)) {
$rows[$iCount][$property->name] = $row[$property->name];
}
$iCount++;
}
return $rows;
}
ajreal
47.4k11 gold badges98 silver badges119 bronze badges
asked Nov 27, 2010 at 13:20
Wouter van Reeven
5453 gold badges8 silver badges17 bronze badges
1 Answer 1
There's no need for the mysql_fetch_field() inner loop. $row will be an associative array with all the row's field's in it. So if you've got fields a, b, c in that table, then you can access them with $row['a'], $row['b'], and $row['c'].
answered Nov 27, 2010 at 13:23
Marc B
362k44 gold badges433 silver badges508 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default
echo $queryand look at the result.