Reputation: 1854
Right so i have php code to update a SQL table. If i replace $_GET['emailID'] with a number say 1 the database IS updated. But otherwise no update. What seems to be wrong here
Table: emails
Fields: mailbox, emailID
$query = 'UPDATE `emails` SET `mailbox`=\'trash\' WHERE `emailID`='.(int)$_GET['emailID'];
Upvotes: 0
Views: 78
Reputation: 1473
$query = "UPDATE `emails` SET `mailbox`='trash' WHERE `emailID`= ".$_GET['emailID'];
Try this one sure it will work
Upvotes: 0
Reputation: 1
Value of attribut must be selected by single quotes. Try this:
$query = "UPDATE `emails` SET `mailbox` = 'trash' WHERE `emailID` = '" . intval($_GET['emailID']) . "'";
Upvotes: 0
Reputation: 22741
Can you try this,
$query = 'UPDATE `emails` SET `mailbox`=\'trash\' WHERE `emailID`="'.(int)$_GET['emailID'].'" ';
Upvotes: 1
Reputation: 68556
Do like this
$query = "UPDATE `emails` SET `mailbox`='trash' WHERE `emailID`=".intval($_GET['emailID']);
Upvotes: 1