robtecc Posted November 3, 2009 Share Posted November 3, 2009 Hello guys, in my PLESK error_log i have always the same error: PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/mysite.com/httpdocs/inc/xtc_db_num_rows.inc.php on line 24 What mean this? Im searching days for the solution, but i dont find the answer. I dont now many about PHP an Mysql Im using a XTCommerce shop on apache with mysql 5.0 by 1and1. I hope someone can give me help! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/ Share on other sites More sharing options...
smerny Posted November 3, 2009 Share Posted November 3, 2009 show the code Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950303 Share on other sites More sharing options...
robtecc Posted November 3, 2009 Author Share Posted November 3, 2009 Hi, sorry, i forgot to post it: function xtc_db_num_rows($db_query,$cq=false) { if (DB_CACHE=='true' && $cq) { if (!count($db_query)) return false; return count($db_query); } else { if (!is_array($db_query)) return mysql_num_rows($db_query); = This is the line 24. } That is all the script Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950307 Share on other sites More sharing options...
smerny Posted November 3, 2009 Share Posted November 3, 2009 can you show the code that is calling this function Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950350 Share on other sites More sharing options...
robtecc Posted November 3, 2009 Author Share Posted November 3, 2009 Hello Smerny, the problem is, that i even dont know wich function is calling this script. I only know, that is called almost evry time if someone visit a page of the shop. Maybe you can tell me how to find it out? I dont know if it is helpful, but a little bit further down i have this: } /* if (!is_array($db_query)) return mysql_num_rows($db_query); if (!count($db_query)) return false; return count($db_query); */ } Thank you Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950363 Share on other sites More sharing options...
smerny Posted November 3, 2009 Share Posted November 3, 2009 i'm just wondering what is being passed in the dp_query parameter try changing } else { if (!is_array($db_query)) return mysql_num_rows($db_query); } to } else { //if (!is_array($db_query)) return mysql_num_rows($db_query); echo "DB_QUERY = ".$db_query; } and see what it says Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950370 Share on other sites More sharing options...
robtecc Posted November 3, 2009 Author Share Posted November 3, 2009 I will try it out now, Thank you Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950372 Share on other sites More sharing options...
robtecc Posted November 3, 2009 Author Share Posted November 3, 2009 Hello, i have try it, but when i was calling the shop, firefox give me the error: Error in the codificacion of the content The page wich you are trying to visualize can not be show caus you are using a format of compression not valid o admit Maybe i wrote something wrong, here the script after edit: function xtc_db_num_rows($db_query,$cq=false) { if (DB_CACHE=='true' && $cq) { if (!count($db_query)) return false; return count($db_query); } else { //if (!is_array($db_query)) return mysql_num_rows($db_query); echo "DB_QUERY = ".$db_query; } Quote Link to comment https://forums.phpfreaks.com/topic/180141-problem-with-db_num_rows/#findComment-950378 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.