PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$rowid = $data["id"];
$setting = $data["setting"];
$post = $_POST['$setting']; ($setting inserted into the post variable)
$query = "UPDATE tblpaymentgateways SET value='$post' WHERE id='$rowid'";
$result=mysql_query($query);
However, it just update blank. I think the problem lies with the $post but not sure how to work around this. Any help would be great
Regards,
John
Johnlbuk wrote:Hi,
I am trying to run a update query. The problem is that the name of the input field changes as the field are created from a table in the database.
I am trying therefore to insert the value from the field in the database using the following code.
$rowid = $data["id"];
$setting = $data["setting"];
$post = $_POST['$setting']; ($setting inserted into the post variable)
$query = "UPDATE tblpaymentgateways SET value='$post' WHERE id='$rowid'";
$result=mysql_query($query);
However, it just update blank. I think the problem lies with the $post but not sure how to work around this. Any help would be great
Regards,
John
$variables will not be parsed inside single quotes!
Try changing $_POST['$setting'] to $_POST["{$setting}"];