Jump to content

need help with my php page


zhshero

Recommended Posts

I need help figuring out why it dose this \/

mypageproblem.png

 

here the page

 

<?php 
require_once('../settings.php');
checkLogin('1 2');
?>
<?
$userfinal = get_username($_SESSION['user_id']);

// 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 '<center><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.
$id=$_GET["delete_id"];
mysql_query("DELETE * FROM messages WHERE message_id='$id' ");
if($row['message_read'] == 0)
{
?>
<head>
<title>ZhsHero Friends</title>
<link href="/themes/theme1/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1>ZhsHero Friends</h1>
<h2>Menu</h2>
<ul>
	<li class="first"><a href="home.php" accesskey="1" title="">Home</a></li>
	<li><a href="mymembers.php" accesskey="2" title="">members</a></li>
	<li><a href="#" accesskey="3" title="">Services</a></li>
	<li><a href="#" accesskey="4" title="">About</a></li>
	<li><a href="#" accesskey="5" title="">Contact</a></li>
</ul>
</div>
<div id="content">
<div id="colOne">
<h3><?php echo 'Welcome ' . get_username ( $_SESSION['user_id'] ) . ''; ?></h3>
<ul class="list">
<img src="<? echo get_main_P ( $_SESSION['user_id'] ) ?>" border=1 width="150" height="150">
</ul>
	<p> </p>
	<h3>news box</h3>
	<p>new box comming soon</p>
</div>
<div id="colTwo">

<p>
<form>
<a href="read_message.php?messageid=<? echo $row['message_id']  ?>">

<img src="<? echo $row['user_photo'] ?>" width="50" height="50" /> 
<a href="read_message.php?messageid=<? echo $row['message_id']  ?>">
<? echo $row['message_title'] ?></a>
<font color="red">(unread)</font>

</a>

<?
}else{
?>
<br>


<a href="read_message.php?messageid=<? echo $row['message_id']  ?>">

<img src="<? echo $row['user_photo'] ?>" width="50" height="50" /> 
<a href="read_message.php?messageid=<? echo $row['message_id']  ?>">
<? echo $row['message_title'] ?></a>
<font color="green">(read)</font>

</a>
<?
}}
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>';
?>
</form>
</p>

</div></div>
<div id="footer">
<p>Copyright (c) 2006 Sitename.com. All rights reserved. Design by <a href="http://freecsstemplates.org/">Free CSS Templates</a>.</p>
</div>

<div style="font-size: 0.8em; text-align: center;">
<br />
Design downloaded from Zeroweb.org: <a href="http://www.zeroweb.org">Free website templates, layouts, and tools.</a><br />
<br />
</div>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/218791-need-help-with-my-php-page/
Share on other sites

You are asking it to display all of that data for each message Id there is in the database.

 

Your problem starts here:

for($count = 1; $count <= $num_messages; $count++)

 

Find everything that is inside of that loop, and it will display that, everytime the loop runs.  Which, like I said, is everytime it finds a message id in the database.

 

PS> Beat by Pik again!

 

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.