I have another problem now. I cannot delete a record in table “doctors”. The name of the field that I specify is “doctor”. My code is here:
<html>
<head>
<title>Deleting Record</title> </head>
<body>
<?php
// Set the variables for the database access:
$Host = "";
$DBName = "";
$TableName = "Doctors";
$Link = mysql_connect ($Host, '', ''); if ($Link==false) {
echo mysql_errno().": ".mysql_error()."<BR>\n";
}
mysql_select_db ($DBName, $Link); $Query = "DELETE FROM $Tablename WHERE Doctor = "ppp""; if (mysql_query ($Query, $Link)) {
print "The query was successfully executed!<BR>\n"; }
else { print "The query could not be executed!<BR>\n";
print mysql_errno().": ".mysql_error()."<BR>\n"; }
?>
</body> </html> I receive the error message
Parse error: parse error in c:***\deleterow.php on line 17
Line 17 is: $Query = "DELETE FROM $Tablename WHERE Doctor = "ppp"";
When I change that line to
$Query = "DELETE FROM $Tablename WHERE Doctor = ‘ppp’";
I receive this error message:
Warning: Undefined variable: Tablename in c:***\deleterow.php on line 17
The query could not be executed!
1064: 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 'WHERE Doctor = 'ppp'' at line 1
I could not understand what is wrong here. Help me pls.