Jump to content

Archived

This topic is now archived and is closed to further replies.

Canman2005

Syntax error

Recommended Posts

Hi all

Why do I get a syntax error when using the sql statement


[code]if ($_GET['action'] == "add")

{    
$sql ="UPDATE users SET type = 4 WHERE id = $id";
@mysql_query($sql, $connection) or die(mysql_error());

}[/code]

I have a action also to delete a row which seems to work fine.

Thanks in advance

Ed

Share this post


Link to post
Share on other sites
Are you sure you have a value for $id, or is your query

$sql ="UPDATE users SET type = 4 WHERE id = ";

As well as outputting mysql_error(), echo the $sql also.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.