TABLE1: table1ID | studentnum | lname | fname | mname
TABLE2: table2ID | studentnum | remarks | others
//THIS IS MY FORM 1
$sql = "INSERT INTO TABLE1 (studentnum, lname, fname, mname)
VALUES ('$studentnum','$lname','$fname','$mname')";
$sql1 = $sql = "INSERT INTO TABLE2 (studentnum)
VALUES ('$studentnum')";
mysql_select_db('databasename');
$retval = mysql_query($sql);
if(!$retval ) {
die('Could not enter data: ' . mysql_error());
}
$retval = mysql_query($sql1);
if(!$retval ) {
die('Could not enter data: ' . mysql_error());
}
echo "Data added successfully!";
mysql_close($conn);
SAMPLE OUTPUT:
TABLE1:
table1ID | studentnum | lname | fname | mname
1 | 1001 | My | An | Swer
TABLE2:
table2ID | studentnum | remarks | others
1 | 1001 | |
Table2现在具有来自表1的studentnum编码数据。 我想要这个输出,我怎么能从FORM 2
这样做//sample output with form1 and form2 values
table2ID | studentnum | remarks | others
1 | 1001 | good | N/A
我有2个表格和2个表格,请参阅上面的代码。任何人都可以帮助我,我该怎么做?