Can anyone help..... When I search on my site this is the error I get
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mounted-storage/home23a/sub003/sc21979-KVVZ/www/ghhookup/functions.php on line 28
This is a peice of the code from function.phpif(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;
}
}
put that into an if statement and go from there.
[php]
if(mysql_num_rows($sql_res)) {
//do something fancy
} else {
exit ("there is no data for you here");
}
[/php]
So this is how is suppose to lookif(mysql_num_rows($sql_res)){
return mysql_fetch_object($sql_res);
}
else {
return '';
}
}
elseif($wtr=='num'){
if(mysql_num_rows($sql_res)) {
//do something fancy
} else {
exit ("there is no data for you here");
}
[php]
if(mysql_num_rows($sql_res)){
if($wtr=='get' || $wtr == 'num'){
return mysql_fetch_object($sql_res);
} elseif($wtr=='res'){
return $sql_res;
} else {
return;
}
}
[/php]
I dont know what you are trying to do by returning a mysql resource if wtr==res, but this should compact some of your logic.
Try this:
[php]
if(mysql_num_rows($sql_res)){
if($wtr=='get' || $wtr == 'num'){
return mysql_fetch_object($sql_res);
} elseif($wtr=='res'){
return $sql_res;
} else {
return;
}
}
[/php]
I dont know what you are trying to do by returning a mysql resource if wtr==res, but this should compact some of your logic.
When I put your script I recieved this:Parse error: syntax error, unexpected $end in /mounted-storage/home23a/sub003/sc21979-KVVZ/www/ghhookup/functions.php on line 4890
there is nothing syntaticlly wrong with the code i gave you, you must have copy and pasted it in correctly. You have a mis-matched { somewhere in there, maybe open the file in an IDE like zend or eclipse to figure out where the error is.
there is nothing syntaticlly wrong with the code i gave you, you must have copy and pasted it in correctly. You have a mis-matched { somewhere in there, maybe open the file in an IDE like zend or eclipse to figure out where the error is.
Ok i am going to send you the file and can you please place the code for me and send it back.
deleting the ?> wont help as you need an ending tag for php, there is a mismatched bracket somewhere in your code, use a code editor like eclipse or zend ide to go through and debug your code.