i have a small problem deleting from the data base that i have created using a form. this is the error that i am getting on the webpage

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 'id_no='806000169'' at line 1

and this the code that i have written to delete entities in my data base



$con = mysql_connect("$hostname","$username","$password");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("$database", $con);

$sql="DELETE  FROM student_course WHERE course_code='$coursecode' ,id_no='$id'";
if (!mysql_query($sql,$con))
  die('Error: ' . mysql_error());
//echo "1 record added";


i can enter entities into the database but some how i just cannot delete using this code. can anyone help me out so that i can delete entities on the database?

instead of:

$sql="DELETE FROM student_course WHERE course_code='$coursecode' , id_no='$id'"


$sql="DELETE FROM student_course WHERE course_code='$coursecode' AND id_no='$id'"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.