0

Hello,

I'm normally pretty good with PHP but since updating to the latest version I can't seem to get most my script's to work.

I am trying to pull two variables, from the database and count how many row's there are.

$query = mysql_query("SELECT * FROM notifications WHERE to='$username' AND read='unread'") or die(mysql_error());
        	
        	$totalNotif = mysql_num_rows($query);

The Error's I am getting are:

With die(): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to='kris' AND read='unread'' at line 1

With out die(): Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\Portal\index.php on line 174
Call Stack
# Time Memory Function Location
1 0.0005 724560 {main}( ) ..\index.php:0
2 0.0017 733312 mysql_num_rows ( ) ..\index.php:174

I do have $username set.

Thanks,

Kris

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.