$stuid = mysql_insert_id();
echo $stuid;
$query2 = ("SELECT
`STU_ID`,`STU_Chinese_Name`,`STU_English_Name`,`STU_Gender`,`STU_Phone_Number`,`STU_Email`,`STU_Notes`,`STU_Birthday`,`STU_Picture`,`STU_joindate`,`STA_English_Name`,`SRC_Source_Name`
FROM source
INNER JOIN students ON source.SRC_ID = students.STU_Source
INNER JOIN staff ON students.STU_Course_Consultant = staff.STA_ID
INNER JOIN transaction_master ON students.STU_ID = transaction_master.TM_Customer_ID
INNER JOIN transaction_detail ON transaction_master.TM_TRX = transaction_detail.TD_ID
INNER JOIN services ON transaction_detail.TD_Service_ID = services.SER_ID
WHERE students.STU_ID = $stuid");
$display = mysql_query($query2) or die ('Error Selecting data to display');
echo "<table class = 'gridtable' >
<thead>
<tr>
<th>ID</th>
<th>Chinese Name</th>
<th>English Name</th>
<th>Gender</th>
<th>Phone</th>
<th>Email</th>
<th>DOB</th>
<th>Join Date</th>
<th>Source</th>
</tr>
</thead>
</tbody>";
while($row = mysql_fetch_array($display))
{
echo "<tr>";
echo "<td>" . $row['STU_ID'] . "</td>";
echo "<td>" . $row['STU_English_Name'] . "</td>";
echo "<td>" . $row['STU_Chinese_Name'] . "</td>";
echo "<td>" . $row['STU_Gender'] . "</td>";
echo "<td>" . $row['STU_Phone_Number'] . "</td>";
echo "<td>" . $row['STU_Email'] . "</td>";
echo "<td>" . $row['STU_Birthday'] . "</td>";
echo "<td>" . $row['STU_joindate'] . "</td>";
echo "<td>" . $row['SRC_Source_Name'] . "</td>";
}
echo "</tbody>";
echo "</table>";
I know the query works fine because if i change the line
WHERE students.STU_ID = $stuid
to this
WHERE students.STU_ID = 167
everything displays. So why will the query not take the variable? I have tried putting these "" `` '' around it but it makes no difference. Any ideas? I had this working in a previous task but it wont work here.

New Topic/Question
Reply



MultiQuote




|