I have a page which updates a mysql database from the input of a form, if the update is successfull i have told it to redirect to another page using
[code=php]print("<SCRIPT LANGUAGE=\"JavaScript1.1\">\n");
print("location = \"jobedited.php?ReferenceCode= echo $id \";\n");
print("</SCRIPT>");[/code]
this should then redirect me to the page with the following code
<?php include("header.inc");
//open db connection
$link=mysqli_connect('localhost','root','voBtGM','JobBase');
$id= $_GET['ReferenceCode'];
//build and execute query
$select="SELECT JobTitle, Salary, Location, Description FROM Jobs Where ReferenceCode=$id";
$result=mysqli_query($link,$select);
$row=mysqli_fetch_assoc($result) or die("query failed".mysql_error());
$JobTitle=$row['JobTitle'];
$Salary=$row['Salary'];
$Location=$row['Location'];
$Description=$row['Description'];
//close db connection
mysqli_close($link);?>
<br>
<TABLE border="1">
<TR><TH>Job Title</TH>
<TH>Salary</TH>
<TH>Location</TH>
<TH>Description</TH>
</TR>
<TR><TD><? echo $JobTitle?></TD>
<TD><? echo $Salary?></TD>
<TD><? echo $Location?></TD>
<TD><? echo $Description?></TD>
</TR>
</TABLE>
</body>
</HTML>
i know this code is correct as if i type in a reference code in the URL it loads the correct data. However, when i try and get it to use the reference code passed from the previous page i get the following error:
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given
So i am guessing i am not passing the variable through the URL properly. Can anyone help me to work out why, if i have not provided the relevent code can someone advise me where to look.
Thanks for any help