Jump to content

Recommended Posts

I downloaded a PM system, becasue I am too lazy to make my own, and on all the pages it came with, I get this error

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mounted-storage/home48c/sub007/sc33591-LWQU/lamezz.info/user/message/inbox.php on line 12

 

what does that mean?

Link to comment
https://forums.phpfreaks.com/topic/91023-what-does-this-mean/
Share on other sites

<?
include 'db.php';

   
print '<div class="box">';
if($session->logged_in)

{
//Get your private message count
//Find the percentage that your inbox is full
$sql = mysql_query ("SELECT pm_count FROM users WHERE username='$user'");
$row = mysql_fetch_array ($sql);
$pm_count = $row['pm_count'];

$percent = $pm_count/'50';
$percent = $percent * '100';
?>
<br>
<center>
<b><p><a href="inbox.php">Inbox</a> | <a href="compose.php">Compose</a> | <a href="sent.php">Sentbox</a></b>
<b><p><? echo "$pm_count"." of 50 Total  |  "."$percent"."% full"; ?></p></b>
</center>
<br>
<?
//This stuff and the while loop will query, see if you have messages or not, and display them if you do
$query = "SELECT id, sender, subject, message FROM messages WHERE reciever='$user'";
$sqlinbox = mysql_query($query);

//Error thingy, ohh no! Dispaly the error and the query so we can diagnose the problem if there is one
if(!$sqlinbox)
	{
	?>
	<p><? print '$query: '.$query.mysql_error();?></p>
	<?
	}

//There are no rows found for the user that is logged in, so I guess that means they dont have any messages or maybe its all broken  
elseif (!mysql_num_rows($sqlinbox) )
	{
	?>
	<center><p><b>You have no messages to display</b></p></center>
	<?
	}

//So if there is not an error, and they apparently do have messages we need to get their information and display it.
else
	{
	//Ok, Lets center this whole table Im going to make just because I like it like that
	//Then we create a table 80% the total width with 3 columns The subject is 75% of the whole table, the sender is 120 pixels (should be plenty) and the select checkboxes only get 25 pixels
	?>
	<center>
	<form name="send" method="post" action="delete.php">
	<table width="80%">
	<tr>
	  <td width="75%" valign="top"><p><b><u>Subject</u></b></p></td>
	  <td width="120px" valign="top"><p><b><u>Sender</u></b></p></td>  
	  <td width="25px" valign="top"><p><b><u>Select</u></b></p></td>
	</tr>
	<?
	//Ok cool, now we stick it all into an array and we will dispaly it now
	while($inbox = mysql_fetch_array($sqlinbox))
		{
		//These are the variables we have the id of the private message, we have the person who sent the message, we have the subject of the message, and yeah thats it
		$pm_id = $inbox['id'];
		$sender = $inbox['sender'];
		$subject = $inbox['subject'];

		//So lets show the subject and make that a link to the view message page, we will send the message id through the URL to that page so it can be displayed
		//And also let the person wee who sent it to them, if you want you can make that some sort of a link to view more stuff about the user, but Im not doing that here, I did it for my game though, pretty much same as the viewmsg.php page but a different page, and with the senders id
		//And finally the checkboxes that are all stuck into an array and if they are selected we stick the private message id into the array
		//I will only let my users have a maximum of 50 messages, remeber that ok? Because that's the value I will use later for things
		?>
		<tr>
		  <td width="75%" valign="top"><p><a href="viewmsg.php?msg_id=<? echo $pm_id; ?>"><? echo $subject; ?></a></p></td>
		  <td width="120px" valign="top"><p><? echo $sender; ?></p></td>
		  <td width="25px" valign="top"><input name="pms[]" type="checkbox" value="<? echo $pm_id; ?>"></td>
		</tr>
		<?
		//This ends the while loop
		}
	?>
	<tr>  
	<td colspan="3"><input type="submit" name="Submit" value="Delete Selected"></td>
	<td></td>
	<td></td>
	</tr>
	</table>
	</center>
	<?
	//So this ends the else to see if it is all ok and having messages or not
	}

//This ends that first thing that checks if you are logged in or not
}
else{
include ("../../style/include/cons/member.php");
}
print '</div>';
include ("../../style/include/cons/foot.php"); 
?> 

Link to comment
https://forums.phpfreaks.com/topic/91023-what-does-this-mean/#findComment-466548
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.