<? //inbox.php
	$data = mysql_query("SELECT * FROM mailbox WHERE `index` <= $index_end and `index` > $index_start")
	or die(mysql_error());
	$info = mysql_fetch_array( $data );
		
	if($info['read'] == 0) {
		echo "<span class=\"tableStyle\">";
		$tabColor = "tableStyleNew";
	}
	else {
		$tabColor = "tableStyleOld";
	}
		//print table start
		echo "<table class=\"$tabColor\" bordercolor=\"#FFFFFF\" border=\"1\" cellpadding=\"0\" cellspacing=\"1\" align=\"center\"> <tr> <td width=\"109\">";
		echo $info['UserName'];
		echo "</td> <td width=\"462\">";

		//print subject and message preview
		$sub_msg = "<strong>" . $info['subject'] . "</strong> - " . $info['message'];
		if(!$info['attachment'] == NULL)
			echo "&nbsp;<img src=\"attachment.gif\" /> ";
		echo "<a href=\"view_message.php\"&nbsp;";
		echo "onclick=\" <?&nbsp;openmail(); ?> \"&nbsp;";
		echo ">" . substr($sub_msg,'',50) ."...</a>";
		//print value send
		
		//print table end
		echo "</td>  <td width=\"90\">";
		echo $info['time'];
		echo "</td>  </tr></table>";
?>


<?  //admin home page

	$index_start = 0;
	$index_end = 10;
	
	function increment() {
		echo $index_start = $index_start + 10;
		echo $index_end = $index_end + 10;
		//header("location:admin_home.php");
	}
	
	function decrement() {
		echo $index_start = $index_start - 10;
		echo $index_end = $index_end - 10;
		//header("location:admin_home.php");
	}
	
	function openmail() {
		//setcookie('1stmsg',$index_start);
		//return $_COOKIE['1stmsg'];
	}
	
	//$index_start = 0;					//1
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//2
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//3
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//4
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//5
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//7
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//8
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//9
	include ('inbox.php');
	
	$index_start = $index_start + 1;	//10
	include ('inbox.php');

                setcookie('1stmsg',"2");
?>
<center><a href="#" onclick="<? decrement(); ?>"> Previous 10</a>  | <a href="#" onclick="<? increment(); ?>">Next 10</a></center>

<?
	include('db_conexn.php');
	/*if(isset($_COOKIE['userName']) {
		echo " cookie set ";
	}*/
	$index = $_COOKIE['1stmsg'];
	$data = mysql_query("SELECT * FROM mailbox WHERE `index` = $index ")
	or die(mysql_error()); 
	$info = mysql_fetch_array( $data );

echo $info['UserName']; 
echo $info['time']; 
echo $info['message']; 
$mail=mysql_query("UPDATE mailbox SET `read` = 1 WHERE `index` = $index");
?>

check it (admin) http://www.yackub.peipians.com/admin.php
user : admin
Pass : 123

client side
user : dan
pass : 123

I would not suggest you publish your password online. Also, can you be be more specific about your problem?

i want to select only one row
in that i want to know which row is clicked!

i saw this error on your admin.php page..

Warning: Cannot modify header information - headers already sent by (output started at /home/peipians/public_html/yackub/admin_home.php:23) in /home/peipians/public_html/yackub/admin_home.php on line 131

For this you simply add ob_start(); at stating lines of your php code...

And coming to your thread ,you can pass your primary key of your message on hyper link like:

<a href="some.php?viewid=code for id" >code for showing message</a>

i saw this error on your admin.php page..

Warning: Cannot modify header information - headers already sent by (output started at /home/peipians/public_html/yackub/admin_home.php:23) in /home/peipians/public_html/yackub/admin_home.php on line 131

For this you simply add ob_start(); at stating lines of your php code...

And coming to your thread ,you can pass your primary key of your message on hyper link like:

<a href="some.php?viewid=code for id" >code for showing message</a>

Thanks Shanti Chepuru,
Both of your sugestions worked correctly...
thanks again

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.