chump2877
02-07-2005, 04:57 AM
Can you find the SQL syntax error in this PHP code:
<?
$dbcon = mysql_connect("localhost","username","password");
mysql_select_db("MyDatabase",$dbcon);
// Reset index number to zero.
$queryK = "UPDATE user_information SET index_no='0' WHERE username LIKE '%".$_SESSION['username']."%'";
$resultK = mysql_query($queryK);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}
// Drop table $username.
$queryB = "DROP TABLE ".$_SESSION['username']."";
$resultB = mysql_query($queryB);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}
?>
I believe the error is somewhere around this line:
$queryK = "UPDATE user_information SET index_no='0' WHERE username LIKE '%".$_SESSION['username']."%'";
Thanks for any help....
<?
$dbcon = mysql_connect("localhost","username","password");
mysql_select_db("MyDatabase",$dbcon);
// Reset index number to zero.
$queryK = "UPDATE user_information SET index_no='0' WHERE username LIKE '%".$_SESSION['username']."%'";
$resultK = mysql_query($queryK);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}
// Drop table $username.
$queryB = "DROP TABLE ".$_SESSION['username']."";
$resultB = mysql_query($queryB);
if (mysql_errno())
{
die("<br>" . mysql_errno() . ": " . mysql_error() . "<br>");
}
?>
I believe the error is somewhere around this line:
$queryK = "UPDATE user_information SET index_no='0' WHERE username LIKE '%".$_SESSION['username']."%'";
Thanks for any help....