954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

query error ? SQL syntax ?

dear all,

$member_id = $_POST['member_id'];
$delete = 'yes';

$HOST = 'localhost';
$USERNAME = 'root';
$PASSWORD = '';
$DB = 'hrs';


$link = mysqli_connect($HOST, $USERNAME, $PASSWORD, $DB);

$query = "UPDATE member SET delete='$delete' WHERE  member_id='$member_id'";

echo $query;


$result = mysqli_query($link, $query) or die(mysqli_error($link));


Any error in my query? it says 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 'delete='yes',member_type='none' WHERE member_id='19'' at line 1
However, This method i uses in other page is has no problem I have no idea what is the error, since everything is the same.

$query = "UPDATE members SET block='$active', role='$role' WHERE id='$id'";


your help is appreciated

qwertpink
Newbie Poster
12 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

The columns in your query and the syntax error don't match - where is member_type='none' come from?

simplypixie
Posting Pro in Training
447 posts since Oct 2010
Reputation Points: 116
Solved Threads: 82
 

Opps sorry wrong syntax error

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 'delete='yes' WHERE member_id='1'' at line 1
qwertpink
Newbie Poster
12 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

Is delete an inbuilt function in mysqli so you can't use it as a column name?

simplypixie
Posting Pro in Training
447 posts since Oct 2010
Reputation Points: 116
Solved Threads: 82
 

OMG YOU ARE RIHGT!

i've change delete to block, and everything works !
Thank you so much , i really appreciate

qwertpink
Newbie Poster
12 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

No problem:)

Please mark your thread as solved.

simplypixie
Posting Pro in Training
447 posts since Oct 2010
Reputation Points: 116
Solved Threads: 82
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: