Hello
I have got 2 tables within the database that are linked by a common 'SectionRef'
I would like to set 'SectionRef' as a variable so that I can use it in a query.
I have tried the following code, and I just get my error message 'could not find information'.
And if I echo $SectionRef it gives 'Array'.
Anybody got any ideas?;
$query = "SELECT SectionRef FROM tblUser WHERE CLogIn = '$username'";
$result = mysql_query($query)
or die ("no info");
$row = mysql_fetch_array($result);
$SectionRef = $row;
/$username comes from login form, I know this works because the 'Welcome $username' code works./
$query = "SELECT (Model) AS Model, (SerialNo) AS SerialNumber , (CommonName) AS Location FROM tblMachine WHERE (SectionRef = $SectionRef) ";
$result1 = mysql_query ($query)
or die ("could not find information");
if ($result1)
{
echo '<table align="centre" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><b>Model</b></td>
<td align="left"><b>Serial Number</b></td>
<td align="left"><b>Location</b></td></tr>';
while ($row1 = mysql_fetch_array($result1,MYSQL_NUM))
{
echo
<tr>
<td width=\"70\" align=\"left\"> $row1[0]</td>
<td width=\"120\" align=\"left\"> $row1[1]</td>
<td width=\"200\" align=\"left\"> $row1[2]</td>
</tr>\n";
}
echo '</table>';
}