Jump to content

[SOLVED] Count Num rows


SirChick

Recommended Posts

Hey, i made a sql to count the number of rows found but it says its not a valid supplied arguement....

Not sure how its typed correctly but this is how i done it:

 

$CountRows = "SELECT * FROM messages WHERE Reciever='$Username'";
			$numrows = mysql_num_rows($CountRows);

			If ($numrows == 3){
			Die('3 is max');
			}

 

The Error:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\composeletterprocess.php on line 37

 

Link to comment
https://forums.phpfreaks.com/topic/73495-solved-count-num-rows/
Share on other sites

$CountRows = "SELECT * FROM messages WHERE Reciever='$Username'";
			mysql_query($CountRows);
			$numrows = mysql_num_rows($CountRows);

			If ($numrows == 3){
			Die('The letter box that belongs to this user is full, perhaps upgrade to better means of communication on the game?');
			}

 

Still getting the problem though =/

Link to comment
https://forums.phpfreaks.com/topic/73495-solved-count-num-rows/#findComment-370752
Share on other sites

try:

 

$CountRows = "SELECT * FROM messages WHERE Reciever='$Username'";
			$numrows2 = mysql_query($CountRows);
			$numrows = mysql_num_rows($numrows2);

			If ($numrows == 3){
			Die('The letter box that belongs to this user is full, perhaps upgrade to better means of communication on the game?');
			}

Link to comment
https://forums.phpfreaks.com/topic/73495-solved-count-num-rows/#findComment-370758
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.