hi
i want to fetch username from another table based on the id generated in the temopary table.
<?php
@ $rpp; //Records Per Page
@ $cps; //Current Page Starting row number
@ $lps; //Last Page Starting row number
@ $a; //will be used to print the starting row number that is shown in the page
@ $b; //will be used to print the ending row number that is shown in the page
if(empty($_GET["cps"]))
{ $cps = "0"; }
else
{ $cps = $_GET["cps"]; }
$a = $cps+1;
$rpp = "10";
$lps = $cps - $rpp; //Calculating the starting row number for previous page
if ($cps <> 0)
{
$prv = "<a href='myagreement.php?cps=$lps"."&user1=".$_SESSION['employerid']."'>Previous</a>";
}
else
{
$prv = "<font color='cccccc'>Previous</font>";
}
mysql_query("DROP TABLE TEMPORARY IF EXISTS Mytemp");
mysql_query("CREATE TEMPORARY TABLE Mytemp SELECT resumeid,ttdate,ttime from agreements WHERE buyerid='".$_SESSION['employerid']."' order by ttdate DESC");
$q="Select SQL_CALC_FOUND_ROWS * from Mytemp limit $cps, $rpp ";
$rs=mysql_query($q) or die(mysql_error());
$nr = mysql_num_rows($rs); //Number of rows found with LIMIT in actiong r
$q0="Select FOUND_ROWS()";
$rs0=mysql_query($q0) or die(mysql_error());
$row0=mysql_fetch_array($rs0);
$nr0 = $row0["FOUND_ROWS()"]; //Number of rows found without LIMIT in action
if (($nr0 < 10) || ($nr < 10))
{
$b = $nr0; }
else
{
$b = ($cps) + $rpp; }
?>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center">
<tr><td><b><font face="verdana" size=2></b></font><b><font face="verdana" size=2 color="#9999CC"></font></b></td></tr>
<tr><td align=left colspan="2"><b><font face="verdana" size=1 color="#9999CC"><? echo "$nr0 Records Found"; ?></font></b></td></tr>
<tr><td align='left' colspan="2"><b><font face="verdana" size=1 color="#9999CC"><? echo "Showing Records from $a to $b"; ?></font></b></td></tr>
</tr>
<?
$i=$nr0;
while ($row=mysql_fetch_array($rs))
{
$cps = $cps +1;
$idd=$row[2];
$result=mysql_query("SELECT username from login where username='.$idd.'");
while ($line=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>";
echo "<table bgcolor='#fefefe' width='73%' align='center' border='0'>";
echo "<tr><td width='55%'><font face='verdana' size=1><strong>Resume ID : </strong></font><a href='agreement1.php?agreeid=".$row[0]."'>RB".$row[0]."</td><td width='25%'><font face='verdana' size=1><strong>Agreement Signed With</strong></font>$line[0]</td></tr>";
echo "<tr><td width='25%'><font face='verdana' size=1><strong>Date </strong></font>".$row[1]."</td><td width='25%'><font face='verdana' size=1><strong>Time </strong></font>".$row[2]."</td></tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
}
echo "<tr><td align='right' colspan=2>$prv";
if ($cps == $nr0)
{ echo " | <font color='CCCCCC'>Next</font>"; }
else
{
if ($nr0 > 5)
{
echo " | <a href='myagreement.php?cps=$cps&lps=$lps&user1=".$_SESSION['employerid']."'>Next</a>";
} } ?>