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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.