
July 31st, 2004, 09:25 PM
|
|
Registered User
|
|
Join Date: Jul 2004
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
mysql_num_rows(): supplied argument is not a valid
hi, i'm getting problem on this:
i get this message when trying to access to the page:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/buayacafe.freelinuxhost.com/friends/functions.php on line 17
Warning: Cannot modify header information - headers already sent by (output started at /home/www/buayacafe.freelinuxhost.com/friends/functions.php:17) in /home/www/buayacafe.freelinuxhost.com/friends/index.php on line 51
this is the first few lines of the function.php
PHP Code:
<? $conn_id; $sql_res; $sql_res2; $sql_query; function sql_connect(){ global $conn_id,$sql_host,$sql_user,$sql_pass,$sql_db; $conn_id=mysql_connect($sql_host,$sql_user,$sql_pa ss); mysql_select_db($sql_db); } function sql_execute($sql_query,$wtr){ global $conn_id; $sql_res=mysql_query($sql_query,$conn_id); if($wtr=='get'){ if(mysql_num_rows($sql_res)){ return mysql_fetch_object($sql_res); } else { return ''; } } elseif($wtr=='num'){ return mysql_num_rows($sql_res); } elseif($wtr=='res'){ return $sql_res; } } function sql_rows($id,$table){ global $conn_id; $query="select $id from $table"; $result=mysql_query($query,$conn_id); $number=mysql_num_rows($result); return $number; } function sql_close(){ global $conn_id; mysql_close($conn_id); }
Can anyone figure out what's the problem? thanks.
|