Hi, You may have, or may not have seen my PPC site: www. cpcads .net I had it on one host, which had PHP4, it worked fine, until the scammer ran off with the server. So now, I'm on a new host .. I transferred all the .php files and got my MySQL server back up. I'm on it, racking my brains why the heck am I getting these errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /disk2/brum/public_html/ads/register.php on line 96 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /disk2/brum/public_html/ads/register.php on line 98 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /disk2/brum/public_html/ads/register.php on line 111 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /disk2/brum/public_html/ads/register.php on line 124 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /disk2/brum/public_html/ads/register.php on line 126 No database selected Code (markup): I didn't get them on my other host ... hmmm .. So I go into the Cpanel and I see.. Noooooooooooooooooooooooo! Does this mean I'll have to rewrite my entire code that took me months? Help is greatly appreciated. Thanks, Lee.
hmm... you have to post more than just the error messages for people to tell you what went wrong... but i would think that the major suspect is the use of post or get variables without the use of $_POST and $_GET make sure that all variables posted to the page are called by using $_POST and variables paged through the url are called by using $_GET or post more details...
This is sort of stating the obvious but I assume you have checked that the login details for your database have been updated for the new host. Other potential issues might be some mysqli / mysql incompatibility but I doubt it.
Thanks for your input guys. I've never used $_GET in my coding, I always use $_POST so I'll look into that. Streety, yeah I have checked that, but only afterwards
Php 4 to 5 migration is usually no problem and we had to rewrite (change a bit) only one script on our server. I don't think this is a php5 issue but you should post some code. No database selected means that the db name has changed when you switched hosts (cpcads_db to cpcad_db for example).
My host has php4 but since php5 runs like cgi script they say that there is a way to enable the php5 support, even when it takes considerable more resources. php5 can be enable via .htaccess thought according their directions. I suppose there must be something similar to switch back to php4 when 5 is already enabled. When running your own linux server, there is indeed a batch command to do so.
Hi BRUm.... This is what I think about your code. Problem. Your code trying to read a number of row from empty resource or empty variable that's why this error happening. Solution. Check your database connection and your database name...make sure your database is exist....and connect successfully Also before you use the mysql_num_rows() ...first check the resources if it's empty or not. example $resource = mysql_query($query); if(empty($resource)){ //if the resource is empty..don't run mysql_num_rows() }else{ //if is not empty ...then run mysql_num_rows() }