Jump to content

Mysql Query


Far Cry

Recommended Posts

Hi there, I am executing this query in the code below, it executes as I want it except when it gets the title, it doesnt get the title for that row it just gets it from the first row in the table... if that makes sense... what is going on?

 

<?php
require'styles/top.php';
?>
<br>

<center><table border='0' width='100%' style='text-align:center; font-weight:bold;'>
<tr>
<td width='33%'>Subject</td>
<td width='33%'>From</td>
<td width='33%'>Date</td>
</tr>
</table></center>
<br>
<?php
		  $query = mysql_query("SELECT * FROM messages WHERE to_user='$username' ORDER BY message_id DESC") or trigger_error('Error: ' . 

mysql_error()); 
$numrows = mysql_num_rows($query);
		if ($numrows > 0){

			while ($row = mysql_fetch_assoc($query)){
				$id = $row['message_id'];
				$from = $row['from_user'];
				$to = $row['to_user'];
				$title - $row['message_title'];
				$content = nl2br($row['message_content']);
                    $date = $row['date'];
				echo"<center><table border='0' width='100%' style='text-align:center; font-weight:bold;'>
<tr>
<td width='33%'>$title</td>
<td width='33%'>$from</td>
<td width='33%'>$date</td>
</tr>
</table></center>
<br>";



			}
	}
	else
		echo '';

	?>
	</div>




	<div id='left'>

	</div>

	<div id='right'>

	</div>

 

 

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.