Upgrading mysql broke a user's script

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
I have a user with a double-opt in mailing list.

After upgrading mysql to 5.0 this user is unable to send a mailing from his script. This is the error he gets:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/user/public_html/admin/newmail.php on line 431

I looked at line 431 of that page and see this:

Code:
$rows=mysql_num_rows($sql);
Can I edit that line to make the script work? If so, how do I edit it?
 

ckh

Well-Known Member
Dec 6, 2003
358
1
168
Phoenix, AZ
cPanel Access Level
DataCenter Provider
That line is basically saying nothing was found in the previous query. The code will probably resemble something like:

$sql = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($sql);

So the actual query would be "Select * from table1"

The problem probably isn't the query in itself but maybe a db that needs to be repaired or perhaps the connection to the db isn't being made causing the error.

You may want to look at the logs or append the query to look like:

$num_rows = mysql_num_rows($sql) or die(mysql_error());

It will then show in more detail the mysql error.
 

junglecat

Well-Known Member
Jul 6, 2004
168
0
166
I'm getting a little lost. Can someone post idiot instructions for exactly what I do where? :eek: