Hi.....here i am able to display only the last row contents.....pls help me......i want to display the rows based on user selection.....here what ever u select it will disply the last row.....

<?php
session_start();

	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?mail_id=<? $mailid=$row['mail_id'];
					 session_register("mailid"); 
?>">
		
<? 
session_start();
	include('database.php');
$mailid1 = $_SESSION['mailid'];
 echo $mailid1;
 $query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."'"  ;

//echo $query1;
$result = mysql_query( $query1 );
//echo mysql_num_rows($result) ;
while($row = mysql_fetch_array($result))
		{ 
		 echo $row['contents'];
		}
mysql_close();

 ?>

hope this works.plz reply

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?mail_id=<? echo $row['mail_id']; ?>"> 
<? session_start();	include('database.php');
$mailid1 = $_GET['mail_id']; 
 $query1="SELECT * FROM  autoalto_mail where mail_id=$mailid1"  ;
 $result = mysql_query( $query1 );
while($row = mysql_fetch_array($result))
		{ 

		 echo $row['contents'];
		}mysql_close();  ?>
commented: Nice suggestion +9

Thanks a lot ..........its working,,,,,,,,i was struggling from yesterday.......

welcome............mark it as solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.