MySQL Forums
Forum List  »  PHP

Re: Trouble with updating Mysql table data
Posted by: Barry Galbraith
Date: March 25, 2012 04:11AM

>PHP is happy to "interpolate:

Ah, but interpolation breaks if you reference an array element with a string index.

e.g. If you had something like this
$sql = "UPDATE library SET title = '$_POST['Title']', author = '$_POST['Author']', status = '$_POST['Status']' WHERE id = $Id ";

Then you have to use concatenation don't you?
$sql = "UPDATE library SET title = '".$_POST['Title']."', author = '".$_POST['Author']."', status = '".$_POST['Status']."' WHERE id = $Id ";

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Trouble with updating Mysql table data
March 25, 2012 04:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.