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

<?php
session_start();


$coursecode=$_POST['code'];
$id=$_SESSION['username'];




$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());
  }
require_once('students_status.php');
//echo "1 record added";

mysql_close($con)
?>

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?
thanks!!!

instead of:

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

try:

$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 meeting, networking, learning, and sharing knowledge.