I know that this is very frequently problem. I have two hosting A and B and one mysql base. On hosting A site works but the same web page (I copy file from A to B) on hosting B doesn't work perfectly. Host, login and password to date base is ok because i see news etc. But when i try login to my admin panel i see:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/dmcmetal/domains/mydomain.com/public_html/config.php on line 31
I add to my config.php file mysql_error(); and now i see:
Something is wrong in your syntax obok '=='1' LIMIT 1' w linii 1
Here is the part of config.php file:
function get_user_data($id=-1) {
if($id==-1) {
$id=$_SESSION['id'];
}
$result= mysql_query("SELECT * FROM `users` WHERE `id`=='{$id}' LIMIT 1");
if($result==FALSE)
die(mysql_error());
if(mysql_num_rows($result)==0) { // 31 line
return false;
}
return mysql_fetch_assoc($result);
}
Can anyone have idea why it works on hosting A and doesn't work on hosting B ?