Dado este script
Código PHP:
<?
function get_records($table,$select,$where=0,$sortby=0,$order=0,$test=0,$limit=0){
// $table is table to get records from
// $sortby is equal to a string of the name of the field you would like to sort by - ie "Name"
// $order is the order you want to sort in and can be either (0 or "ASC") for "ASC" or (1 or "DESC") for "DESC"
if ($where) $where_string = "WHERE $where";
if (!$select) $select = "*";
if ($order==0 || $order=="ASC") $order_string = "ASC";
if ($order==1 || $order=="DESC") $order_string = "DESC";
if ($sortby) $sort_string = "ORDER BY $sortby $order_string";
if ($limit) $limit_string = $limit;
$query = "SELECT $select FROM $table $where_string $sort_string $limit_string";
if ($test) print "query is $query<br>";
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result)) { // ESTA ES LA LÍNEA 17
$records[] = $row;
}
return $records;
}
?>
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ......... línea 17, y no me aclaro con qué está mal escrito, a ver si me haceis el favor de hecharme una mano, muchas gracias de antemano y salu2