Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/11/2005, 03:15
mon
 
Fecha de Ingreso: febrero-2003
Mensajes: 506
Antigüedad: 21 años, 2 meses
Puntos: 0
Me hechais una mano con este script?, por favor

Hola a tod@s.
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==|| $order=="ASC"$order_string "ASC";
if (
$order==|| $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;
}
?>
Me dá un warning:
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