Warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL -


warning: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'color:red'>

and code :

$db->query("update members set id='{$this->test['id']}',       lvl='{$this->userlvl}', ip='{$this->test['ip']}',       time='{$this->test['time']}',       linechat='{$this->test['msg']}'       user='{$this->test['name']}'"); 

i'm beginner please tell me must ^^

i have tried

$fixchat = mysql_real_escape_string($this->test['msg']); $fixname = mysql_real_escape_string($this->test['name']);  $db->query("update members set id='{$this->test['id']}',      lvl='{$this->userlvl}', ip='{$this->test['ip']}',       time='{$this->test['time']}', linechat='{$fixchat}'       user='{$fixname}'"); 

but got error :

warning: have error in sql syntax; check manual corresponds mysql server version right syntax use near ''\wellington\'' @ line 1...

one or more of values in $this->test array has double quote characters in it. every dynamic element query string must escaped passing through appropriate escape function (in case mysql_real_escape_string()). escape quotes string interpreted correctly.

side note: should using mysqli php library instead of mysql, deprecated. also, better alternative solution use parameterized queries.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -