Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 02-07-2005, 04:57 AM   PM User | #1
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 1,890
Thanks: 5
Thanked 22 Times in 18 Posts
chump2877 is on a distinguished road
SQL syntax error

Can you find the SQL syntax error in this PHP code:

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:

PHP Code:
$queryK "UPDATE user_information SET index_no='0' WHERE username LIKE '%".$_SESSION['username']."%'"
Thanks for any help....
__________________
Regards, R.J.

Media Moguls
Cleveland, Ohio Web Site Design and Application Development

Last edited by chump2877; 02-07-2005 at 01:54 PM..
chump2877 is offline   Reply With Quote
Old 02-07-2005, 08:46 AM   PM User | #2
Brandoe85
teh Moderatorinator


 
Join Date: Sep 2004
Location: USA
Posts: 2,435
Thanks: 2
Thanked 38 Times in 38 Posts
Brandoe85 will become famous soon enough
echo out $_SESSION['username'] make sure it has a value. I'm thinking it's with your drop table query.
__________________
-Brando
Why using tables for eating is stupid!

Last edited by Brandoe85; 02-07-2005 at 08:54 AM..
Brandoe85 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:31 AM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.