ishlux -3 Junior Poster

Hi this is the code for showing the inbox........

<table 	style="border:1px solid #EDEDED;background-color:#f6f6f6" 
  border="0" width="100%">
		<tr	>

			<!--<td width="5%"></td> -->
			<td background="images/auto_alto_car_repair_login_silver_boxR1C1.jpg" width="20%" ><b><font size="3"><span style="color:005D95">From</span></b></td>
			<!--<td class="tcat" ><b><font size="3"><span style="color:005D95">Subject</span></b></td>-->
			<td background="images/auto_alto_car_repair_login_silver_boxR1C1.jpg" width="40%" ><b><font size="3"><span style="color:005D95">Subject</span></b></td> 
			<td background="images/auto_alto_car_repair_login_silver_boxR1C1.jpg" width="20%"><b><font size="3"><span style="color:005D95">Date</span></b></td>
		</tr>


<?
session_start();
include('database.php');
$page_name="contractor_inbox.php";
//$limit=sql_quote($_GET['limit']); // Read the limit value from query string.
$limit=$_GET['limit'];
//$start=sql_quote($_GET['start']); // To take care global variable if OFF
$start=$_GET['start'];
if(!($start > 0))
{ // This variable is set to zero for the first page
$start = 0;
}

$eu = ($start - 0); 
if(!$limit > 0 )
{ // if limit value is not available then let us use a default value
$limit = 4; // No of records to be shown per page by default.
} 
$this1 = $eu + $limit; 
$back = $eu - $limit; 
$next = $eu + $limit; 
//*****************************************************************/
$result = mysql_query("SELECT * FROM autoalto_mail where flag!='1'  limit $eu, $limit" ); 

//code for paging
//************************************************************************** 
$selcount = "SELECT * FROM autoalto_mail ORDER BY primarykey column name DESC" ;
$selcount =  "SELECT * FROM autoalto_mail where flag!='1'" ;
$result2=mysql_query($selcount);
$nume=mysql_num_rows($result2);
//echo $nume;
//session_register("nume");
//$nume = $_SESSION['nume'];
//session_register("nume");
$_SESSION['nume']=$nume;

//echo "<table>";
//**************************************************************************
while($row = mysql_fetch_array($result)) 
{?> 
<tr class="sectiontableentry2" ><!--<td width="5%"></td>-->
<td><? echo $row['From_user'];?></td> 
<td><a href="contractor_inbox.php?start=<?=$start?>&limit=<?=$limit?>&mail_id=<?=$row['mail_id'];

//session_register("mail_id");
//session_register("mail_id");
?>">
<?echo $row['subject'];
$subj=$row['subject'];
session_register("subj");?> </a></td>
<td><?echo $row['date'];?></td>
</tr>
<!--<tr class="sectiontableentry1"></tr>

<!--<tr class="sectiontableentry1"><td width="5%"></td>
<td colspan="4" style="background-repeat: repeat-x;" background="images/dot.jpg" height="0" width="300"></td></tr>-->
<?
}?>
</table>
<?
if($nume > $limit)
{
//Counting no of pages and the current page.
$totnumofpages = round($nume/$limit);
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i == $eu)
{
$currentpage= $l;
}
$l=$l+1;
} 

echo "<div height=28 align=right><table cellpadding=3 cellspacing=1 border=0 height=28><tr><td>Page ".$currentpage." / ".$totnumofpages."</td>";
//// if our variable $back is equal to 0 or more then only we will display the link to move back //////// 
if($back >=0) 
{ 
print "<td align='left'><a href='$page_name?start=$back&limit=$limit'>&lt;</a></td>"; 
} 
//////////////// We will not display the current page as a link ///////////
$i=0;
$l=1;
for($i=0;$i < $nume;$i=$i+$limit)
{
if($i <> $eu)
{
echo "<td align=center><a href='$page_name?start=$i&limit=$limit'><span>$l</span></a></td>";
}
else 
{ 
echo "<td align=center><span><b>$l</b></span></td>";
} /// Current page is not displayed as link 
$l=$l+1;
}
///////////// If we are not in the last page then Next link will be displayed. Here we check that /////
if($this1 < $nume) 
{ 
print "<td align=center width=15><a href='$page_name?start=$next&limit=$limit'><span ><b>&gt;</b></span></a></td>";
} 
echo "</tr></table></div>";
}
mysql_close();
?>
</td>
</tr>
<tr><td>&nbsp;</td></tr>

<tr>
	<td>
	<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="border:1px solid #EDEDED;background-color:#f6f6f6">
	<tr>
		<td width="100%">
		<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" >
		<tr>
			<td><img src="images/box_left.gif" width="10" height="31" alt=""></td>
			<td nowrap  background="images/box_topbg.gif" width="100%" height="31">
			<table cellpadding="0" cellspacing="0" width="100%" border="0" >
			<tr>
				<td style="padding-left:5px;" class="headtitle">Mail Preview</td>
				<td align="right" colspan="3" style="color:red"> <a href="contractor_mail_quotation.php">Open in new window</a></td>
			</tr>
			</table>
		<td><img src="images/box_right.gif" width="10" height="31" alt=""></td>
	</tr>

<tr>
	<td background="images/box_leftbg.gif" width="10"></td>
</tr>
</table></td></tr>

<tr>
	<td>
	<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%"  style="border:1px solid #EDEDED;background-color:#ffffff">
	<tr><td><b><font size="2"><span style="color:005D95">Subject:</span></b>
<? 
session_start();
include('database.php');
$_SESSION['mail_id']=$_GET['mail_id'];
$mailid1 = $_GET['mail_id']; 

$query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."' AND flag!='1'";
$result = mysql_query( $query1 );

while($row = mysql_fetch_array($result))
{ 
	echo $row['subject'];
}
mysql_close();
?>
</b></td>
<td align="right" colspan="3" style="padding-left:5px;" class="headtitle"> 
<a href="Contractor_inbox_reply.php"><b>Reply</b></a><span >/</span>
<a href="contactor_inbox_delete.php"><b>Delete</b></a><span>/</span>
<a href="contractor_next.php"><b>Next</b></a></td></tr>
<tr><td><b><font size="2"><span style="color:005D95">From:</span></b>
<? 
session_start();
include('database.php');
$mailid1 = $_GET['mail_id']; 
$query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."' AND flag!='1'";
$result = mysql_query( $query1 );
$num=mysql_num_rows($result);
	
	
while($row = mysql_fetch_array($result))
{ 
	echo $row['From_user'];
}
mysql_close();
 ?>										
</b></td></tr>
</table>
</td></tr>

<tr><td>
<? 
session_start();
include('database.php');
$mailid1 = $_GET['mail_id']; 
//session_register('mailid11');
echo $_GET['mail_id'];

$query1="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."' AND flag!='1'";
$result = mysql_query( $query1 );
//echo mysql_num_rows($result) ;
while($row = mysql_fetch_array($result))
{ 
    echo $row['contents'];
}
mysql_close();
?>

and this is the code for next link.....

<?php
   session_start();
include('database.php');
$mailid1 = $_GET['mail_id']; 
      $t="SELECT * FROM  autoalto_mail where mail_id='".$mailid1."' AND flag!='1'" ;
   
      $i=mysql_query($t);
   
      $row=mysql_fetch_array($i);
   
      $n="select * from autoalto_mail where mail_id > '".$row['mail_id']."'";
   
      $p=mysql_query($n);
   
      $d=mysql_fetch_array($p);//here you will get next message...
   
      $nextid=$d['mail_id'];
   
      $previd=$row['mail_id'];
	  mysql_close();

  ?>

where should i insert this code...........

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.