ishlux -3 Junior Poster

Hi all, this is for trash, i am facing some problem, here if the user deletes inbox items or sent items it should come and sit in trash. here i am able select the flag='1' i mean deleted items but i want display them. which ever is deleted either from trash or sent it should come n sit in trash.how to do it. pls help , just go through the code u can understand my problem.

<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 background="images/auto_alto_car_repair_login_silver_boxR1C1.jpg" width="20%" ><b><font size="3"><span style="color:005D95">To</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_trash.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 as a1, autoalto_contractor_sentitems as a2 where a1.flag='1' AND a2.flag='1'  limit $eu, $limit" ); 

//code for paging
//************************************************************************** 
//SELECT * FROM autoalto_mail as a1, autoalto_contractor_sentitems as a2 where a1.flag='1'=a2.flag 
$selcount = "SELECT * FROM autoalto_mail as a1, autoalto_contractor_sentitems as a2 where a1.flag='1' AND a2.flag='1' " ;

$result2=mysql_query($selcount);
$nume=mysql_num_rows($result2);
echo $nume;
//echo "<table>";
//**************************************************************************
while($row = mysql_fetch_array($result)) 
{?> 
<tr  class="sectiontableentry2"><!--<td width="5%"></td>-->
<td><? echo $row['From_user'];?> </td>
<td><? echo $row['to_user'];?> </td>
<td><a href="contractor_trash.php?mail_id=<? echo $row['mail_id'];?>">
<?echo $row['subject'];
$subj=$row['subject'];
session_register("subj");?> </a></td>
<td><?echo $row['date'];?></td>
</tr>
<!--<tr><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();
?>