i create temporary table and insert values from multi table, insert values in while loop
but i can not query values from temporary table. what 's wrong?
my code is........
<?
mysql_connect($host,$user,$passwd);
$sql1="create temporary table if not exists tpsbdss ( tfcid mediumint(5) zerofill not null, tuid varchar(4), tcid varchar(4), pgpa int, pclimate int, totpt int, primary key (tfcid))";
$result1 = mysql_db_query($dbname,$sql1);
$sql = "select tp.tfcid, fc.fcid,fc.gpa, c.climate from fieldcourse as fc, tpsbdss as tp, city as c where fc.fcid=tp.tfcid and c.cid=fc.cid";
$result = mysql_db_query($dbname, $sql);
while ($row=mysql_fetch_array($result)) {
//$tfcid=$row["tfcid"]; $fcid = $row["fcid"];
($igpa >= $row["gpa"]) ? $rgpa = 8 : $rgpa=0;
$wgpa=8;
$pgpa = $rgpa * $wgpa;
if ($iclimate == "any") {
$rclimate = 1;
}
else {
($iclimate == $row["climate"]) ? $rclimate = 8: $rclimate=0;
}
$wclimate = 8;
$pclimate=$rclimate$wclimate;
$totpt = $pgpa + $pclimate;
$sql5 = "insert into tpsbdss (pgpa,pclimate,totpt) values ('$pgpa','pclimate','$totpt') where tfcid='$tfcid'";
$rs5 = mysql_db_query($dbname,$sql5);
}
echo "<table>";
$sql = "select from tpsbdss";
$rs = mysql_db_query($dbname,$sql);
while ($row=mysql_fetch_array($rs)) {
$tfcid = $row["tfcid"];
$pgpa = $row["pgpa"];
$pclimate = $row["pclimate"];
$totpt = $row["totpt"];
echo "<tr><td>$tfcid</td><td>$pgpa</td><td>$pclimate</td><td>$totpt</td></tr>";
}
echo "</table>";
?>