I have a page where I'm trying to display checkboxes for records from a table, but am just getting an error :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Can anyone have a look and see if they can spot where its going wrong?
The PHP looks like :
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<form name="form1" id="form1" method="POST" action="canProfileEdited.php">
<input type='hidden' name='packageID' value='<?php echo $packageID; ?>'>
<?php
require_once('../Connections/connPackages.php');
error_reporting(E_ALL & E_STRICT);
$packageID = 1;
if (isset($_GET['packageID'])) {
$packageID = intval($_GET['packageID']);
}
//Get photokeywords & put into array
mysql_select_db($database_connPackages, $connPackages);
$query_Keyword_Match = sprintf("SELECT * FROM packagedestinations WHERE destinationID = %s", $destinationID);
$Keyword_Match = mysql_query($query_Keyword_Match, $connPackages) or die(mysql_error());
$packagedestinations = array();
while ($row_Keyword_Match = mysql_fetch_assoc($Keyword_Match)) {
$packagedestinations[] = $row_Keyword_Match['destinationID'];
}
//Get all the keywords
$sql = "SELECT * FROM destinations ORDER BY destination";
$query = mysql_query($sql);
$current_category = "";
$row_type = "";
$column = 1;
while ($keyword=mysql_fetch_assoc($query)) {
//Create new row if 1st keyword
if ($column == 1) {
$row_type = ($row_type=="odd")?"even":"odd";
echo "<tr class=\"".$row_type."\">";
}
//Display the checkbox
echo "<td width=\"2%\">";
echo "<input type=\"checkbox\" class=\"tickbox_".$row_type."\"";
if (in_array($keyword['destinationID'],$packagedestinations)) { echo " checked"; }
echo " name=\"ckbox[".$keyword['destinationID']."]\" id=\"ckbox[".$keyword['destinationID']."]\">";
echo "</td>\n";
//Display the Keyword
echo "<td width=\"18%\" align=\"left\">".$keyword['destination']."</td>\n";
//Close the row if 5th keyword OR increase column count
if ($column == 4) { echo "</tr>"; $column = 1; }
else { $column++; }
}
if ($column != 1) { echo "</tr>"; }
?>
<tr>
<td align="left" colspan="4">
<tr>
<td align="left" colspan="4">
<input type="submit" name="Submit" value="Update Candidate Profile">
<input type=button value="Cancel" onClick="history.go(-1)">
</form></td>
</tr>
</table>
Thanks.