Page 1 of 1

a little trick -- read from different tables into same form

Posted: Tue May 22, 2012 9:55 am
by inosent1

Code: Select all


<?
include("dbinfo.inc.php");
// grabbing variables from the url, but they can come from anywhere you want
$t2 = $_GET["id"];
$t1 = $_GET["file_id"];

$sql= mysql_query("select * from table1 where file_id = '$term2'");
$sql2 = mysql_query("select * from table2 where file_id = '$term2'");
$sql3 = mysql_query("select * from table3 where file_id = '$term2' AND id = '$t2'");

while (($row = mysql_fetch_array($sql)) && ($row_x = mysql_fetch_array($sql2)) && ($row_z = mysql_fetch_array($sql3)))
{
?>
<form>
<input name="fname" value="<?php echo $row['fname'];?>"></span> <br>
<input name="order" value="<?php echo $row_x['order'];?>"></span> <br>
<input name="item" value="<?php echo $row_z['item'];?>"></span> <br>
</form>
<?
}
?>



Re: a little trick -- read from different tables into same f

Posted: Tue May 22, 2012 10:01 am
by Celauran