trying to delete a row from database using PHP
<p>I am trying remove a row from database while clicking on the remove link. but received the below error message :</p>

<p>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</p>

<p>below is the code :</p>

<p>remove_db.php</p>

<pre><code>&lt;html&gt;
&lt;body&gt;

&lt;?php
//session_start();
$myusername = $_SESSION['uname'];


$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="vacation_tool"; // Database name
$tbl_name="login"; // Table name

// Connect to server and select databse.
$con = mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$query="select EmployeeID,FirstName,LastName,ManagerName from users";

$result=mysql_query($query);

$num=mysql_numrows($result) or die ("error in function_name: &lt;br&gt;Sql: " . $sql . "&lt;br&gt;" . mysql_error());

//mysql_close();
?&gt;
&lt;div id="bv_Text2" style="position:absolute;left:480px;top:250px;width:550px;height:16px;z-index:5;" align="left"&gt;
&lt;table border="1" cellspacing="2" cellpadding="2"&gt;
&lt;tr width = "100%"&gt;
&lt;td width = "15%" align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;b&gt;Employee ID&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td width = "20%" align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;b&gt;First Name&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td width = "20%" align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;b&gt;Last Name&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td width = "20%" align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;b&gt;Manager Name&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;

&lt;/tr&gt;
&lt;/div&gt;


&lt;?php
$i=0;
while ($i &lt; $num) {

$f1=mysql_result($result,$i,"EmployeeID");
$f2=mysql_result($result,$i,"FirstName");
$f3=mysql_result($result,$i,"LastName");
$f4=mysql_result($result,$i,"ManagerName");

?&gt;
&lt;div id="bv_Text2" style="position:absolute;left:480px;top:260px;width:144px;height:16px;z-index:6;" align="left"&gt;
&lt;tr&gt;
&lt;td align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;?php echo $f1; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;?php echo $f2; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;?php echo $f3; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;?php echo $f4; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td align = "center"&gt;&lt;font style="font-size:13px" color="#000000" face="Arial"&gt;&lt;?php echo '&lt;td&gt;&lt;a href="remove.php?EmployeeID=' . $num['EmployeeID'] . '"&gt;Remove&lt;/a&gt;&lt;/td&gt;'; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/div&gt;
&lt;?php
$i++;
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>and remove.php :</p>

<pre><code>&lt;?php

session_start();
$myusername = $_SESSION['uname'];

$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="vacation_tool"; // Database name
$tbl_name="login"; // Table name

// Connect to server and select databse.
$con = mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form

if (isset($_GET['EmployeeID']))
 {
 // get id value
 $EmployeeID = $_GET['EmployeeID'];

 // delete the entry

 $query = "DELETE FROM users WHERE EmployeeID = $EmployeeID";

 $result = mysql_query($query) or die(mysql_error());

 // redirect back to the view page
 header("Location: remove_user.php");
 }
 else
 // if id isn't set, or isn't valid, redirect back to view page
 {
 echo "Error";
 }

 ?&gt;
</code></pre>

<p>please help me.</p>
