so i had a manage.php which basically had edit/del/add/view code inside it. even tho edit and add are seperate you get where im coming from. since i had a fully working script i have added more fields into the areas and now there is an error where as usual it seems alright.
please have a scan of the code to see if you can help me. i think its only a simple mistake but im not sure.
here is the 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
here it is:
<link href="style.css" rel="stylesheet" type="text/css">
<?
require ("../../../cgi-bin/connect2test.php");
#---------------------------------------------------------------------------------------------------------------#
# // \\ // \\ // \\ // \\ // \\ // \\ // \\ // DELETE RECORD \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ #
#---------------------------------------------------------------------------------------------------------------#
if ($task=="del") {
$SQL = " DELETE FROM ".$tablename." ";
$SQL = $SQL . " WHERE id = $id ";
mysql_db_query($db, "$SQL", $cid);
echo "Record Deleted<br>
<- <a href='$PHP_SELF?task=ed-del-menu'>Back to the Edit / Delete Menu</a><br>
".$back."";
} elseif ($task=="ed-del-menu") {
#===============================================================================================================#
#---------------------------------------------------------------------------------------------------------------#
# // \\ // \\ // \\ // \\ // \\ // \\ // \\ EDIT - DELETE MENU // \\ // \\ // \\ // \\ // \\ // \\ // \\ // #
#---------------------------------------------------------------------------------------------------------------#
$SQL = " SELECT * FROM ".$tablename." ";
$retid = mysql_db_query($db, "$SQL", $cid);
if (!$retid) { echo( mysql_error()); }
else {
echo ("<ul>Record Edit/Delete Menu\n");
while ($row = mysql_fetch_array($retid)) {
$name = $row["name"];
$id = $row["id"];
$position = $row["position"];
$email = $row["email"];
$location = $row["location"];
$skills = $row["skills"];
$resume = $row["resume"];
echo ("<li>ID Number: <b>".$id."</b>. Name: <b>".$name."</b> ( <A HREF='edit.php?id=$id'>Edit</A> / <A HREF='$PHP_SELF?id=$id&task=del'>Delete</A> )</li>");
}
echo ("</ul><br>".$back."");
#===============================================================================================================#
}
#---------------------------------------------------------------------------------------------------------------#
# // \\ // \\ // \\ // \\ // \\ // \\ // \\ VIEW ALL RECORDS // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ #
#---------------------------------------------------------------------------------------------------------------#
} elseif ($task=="view") {
# setup SQL statement
$SQL = " SELECT * FROM ".$tablename." ";
# execute SQL statement
$retid = mysql_db_query($db, "$SQL", $cid);
# check for errors
if (!$retid) { echo( mysql_error()); }
else {
# display results
echo ("All Data Records<br><table width='100%' border=1 cellspacing=0 cellpadding=0><tr><td>");
while ($row = mysql_fetch_array($retid)) {
$name = $row["name"];
$id = $row["id"];
$position = $row["position"];
$email = $row["email"];
$location = $row["location"];
$skills = $row["skills"];
$resume = $row["resume"];
echo ("<table border=1 cellspacing=1 cellpadding=1>
<tr><td colspan=5>ID: ".$id."</td></tr>
<tr><td>Name:</td><td>Skills:</td></tr>
<tr><td>".$name."</td><td rowspan=7>".$skills."</td></tr>
<tr><td>Position:</td></tr><tr><td>".$position."</td></tr>
<tr><td>Location:</td></tr><tr><td>".$location."</td></tr>
<tr><td>Email Address:</td></tr><tr><td><a href='mailto:".$email."'>".$email."</a></td></tr>
</table>");
}
echo ("</td></tr></table>");
}
#===============================================================================================================#
#---------------------------------------------------------------------------------------------------------------#
# // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ MAIN MENU // \\ // \\ // \\ // \\ // \\ // \\ // \\ \\ // #
#---------------------------------------------------------------------------------------------------------------#
} else {
echo "This is the main menu where you can add / edit or delete records and upload an image.<br>
Add a Record: <a href='add.php'>Click Here</a><br>
Edit or Delete a Record: <a href='$PHP_SELF?task=ed-del-menu'>Click Here</a><br>
View the Records: <a href='$PHP_SELF?task=view'>Click Here</a><br>
Upload an Image: <a href='upload.php'>Click Here</a>";
}
?>