phpwiz Posted August 13, 2009 Share Posted August 13, 2009 can some one tell me why the message title link is not displaying? <?php session_start(); require "connect.php"; $userfinal = $_SESSION['username']; // get the messages from the table. $get_messages = mysql_query("SELECT message_id FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error()); $get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error()); $num_messages = mysql_num_rows($get_messages); // display each message title, with a link to their content echo '<ul>'; for($count = 1; $count <= $num_messages; $count++) { $row = mysql_fetch_array($get_messages2); //if the message is not read, show "(new)" after the title, else, just show the title. if($row['message_read'] == 0) { echo "<table border='1' border-width='1px' width='400px'>"; echo " <tr> <td bgcolor='#E7E29A'><div align='center'><font color='darkred' face='arial' size='4'><u>Status</u></font></div></td> <td bgcolor='#E7E29A'><div align='center'><font color='darkred' face='arial' size='4'><u>Title</u></font></div></td> </tr> <tr> <td bgcolor='#FFFFFF' width='100px'><div align='center'><text align='left'><font color='#000000' face='arial' size='3'>[New]</td> <td bgcolor='#FFFFFF'><text align='center'><font color='#000000' face='arial' size='3'><div class='text'><a href='read_message.php?message_id=" .$row['message_id']. ">" .$row['message_title']. "</a></div></font></td> </td> </tr>"; echo "</table>"; } else { echo "<table border='1' border-width='1px' width='400px'>"; echo " <tr> <td bgcolor='#E7E29A'><div align='center'><font color='darkred' face='arial' size='4'><u>Status</u></font></div></td> <td bgcolor='#E7E29A'><div align='center'><font color='darkred' face='arial' size='4'><u>Title</u></font></div></td> </tr> <tr> <td bgcolor='#FFFFFF' width='100px'><div align='center'><text align='left'><font color='#000000' face='arial' size='3'>[Read]</td> <td bgcolor='#FFFFFF'><text align='center'><font color='#000000' face='arial' size='3'><div class='text'><a href='read_message.php?message_id=" . $row['message_id'] .">" .$row['message_title']. "</a></div></font></td> </td> </tr>"; echo "</table>"; } } echo '</ul>'; echo '<form name="newmsgfrm" method="post" action="new_message.php">'; echo '<input type="submit" value="Send a New Message">'; echo '</form>'; echo '<form name="backfrm" method="post" action="index.php">'; echo '<input type="submit" value="Back to Home">'; echo '</form>'; ?> it is just blank like no text or link..? Link to comment https://forums.phpfreaks.com/topic/170044-inboxphp/ Share on other sites More sharing options...
play_ Posted August 13, 2009 Share Posted August 13, 2009 Start debugging. echo out $row['message_title'] first thing in your if statements. check HTML source to make sure its tidy Link to comment https://forums.phpfreaks.com/topic/170044-inboxphp/#findComment-897035 Share on other sites More sharing options...
phpwiz Posted August 13, 2009 Author Share Posted August 13, 2009 Start debugging. echo out $row['message_title'] first thing in your if statements. check HTML source to make sure its tidy i did de-bug it :/ Link to comment https://forums.phpfreaks.com/topic/170044-inboxphp/#findComment-897038 Share on other sites More sharing options...
phpwiz Posted August 13, 2009 Author Share Posted August 13, 2009 still not working......... can anyone help please!!!! Link to comment https://forums.phpfreaks.com/topic/170044-inboxphp/#findComment-897040 Share on other sites More sharing options...
play_ Posted August 13, 2009 Share Posted August 13, 2009 try replacing this // get the messages from the table. $get_messages = mysql_query("SELECT message_id FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error()); $get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error()); $num_messages = mysql_num_rows($get_messages); with // get the messages from the table. $get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user='$userfinal' ORDER BY message_id DESC") or die(mysql_error()); $num_messages = mysql_num_rows($get_messages2); notice the '2' in mysql_num_rows($get_messages2); You also don't need a for loop. You could do while( $row = mysql_fetch_array($get_messages2) ) { //ouput } so you dont need $num_messages, nor the first query (especially since the second query replaces the first one, as they use the same identifier) Link to comment https://forums.phpfreaks.com/topic/170044-inboxphp/#findComment-897207 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.