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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

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

Post 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>
<?
}
?>


User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

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

Post by Celauran »

Post Reply