开发者

SQL Update Problem

开发者 https://www.devze.com 2023-02-05 13:32 出处:网络
I am trying to update a record in MySQL DB but nothing is being changed. Here is the line I am using to try to get the record updated.

I am trying to update a record in MySQL DB but nothing is being changed.

Here is the line I am using to try to get the record updated.

$sql = "UPDATE ".$this->Tbl." SET name = '".$data['name']."', title  = '".$data['title']."', message = '".$data['message']."', ', picture = '".$filename_update.".jpg' WHERE id = '".$data['id']."'";
 echo $sql;
 $db->connect();
 $result = mysql_query($sql);
 $db->disconnect();
 return $result;
开发者_C百科

There are no errors being reported. In fact I am getting confirmation that all the information is correct in the update line.


I noticed that right before your picture column, you have an extra ',. Perhaps this is causing the issue?


When you execute that statement, perhaps try checking for number of records effected.

  echo mysql_affected_rows();


It's really hard to say what's happening without seeing the SQL string you construct.

At a guess, however, you have an embedded single quotation mark in message or another variable.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号