Hi just go through this code.......

<?php

	include('database.php');
$result = mysql_query("SELECT * FROM  autoalto_mail");
	
while($row = mysql_fetch_array($result))
		{
		?>
		
			
				<tr><td width="10%"></td>
				<td ><img src="images/buldot.gif" alt="" height="6" width="6">

				<?echo $row['from']?></td>
				<td ><a href="contractor_mail_action_contents.php"><?echo $row['subject']?></a></td>
				<td><?echo $row['date']?></td>
			</tr>
				
										<tr><td width="10%"></td>
									    <td colspan="4" style="background-repeat: repeat-x;"   background="images/dot.jpg" height="0" width="300"></td></tr>
									
	
		
		<?		
	
	
}
	
mysql_close();
 ?>

Here i am displaying the values from db .....those are from, subject and date

actually in the table it has 4 columns from ,subject ,date and contents. but i am displaying only 3 of them. what i want is if the user clicks on the subject it should possible display the contents of that particular subject........in the same page . pls help me how to do this.

But i dont know ajax..........its ok let it be in the next page.........but i want the solution ...........

ok, so on line 19 you have a url, you are going to make sure that it redirects back to this page with a query string, you are going to change it to

<td ><a href="<? echo $_SERVER['PHP_SELF']; ?>?id=<? echo $row['tablepk']; /* the primary key of that row */ ?>"><? echo $row['subject']?></a></td>

Then you are going to add this between lines 7 and 8

if(isset($_GET['tablepk']))
{
    $where = " where tablepk = '" . mysql_real_escape_string($_GET['tablepk']) . "'";
}
else
{
    $where = "";
}

then you are going to tack on the $where variable on the end of the query

that should do it.

This article has been dead for over six months. Start a new discussion instead.