want to add a value to pre existing auto increment unique row with an $_POST[id] that is in that page
if ($_POST['status']=='APPROVED'){
$db = mysql_connect( "xxxx", "xxxxx", "xxxxx", "xxxxxxx" ) or die ("not able to connect.");
mysql_select_db( "xxxxxx", $db );
$query = "INSERT INTO attendees (payment_status)VALUES ('PAID')";
mysql_query($query) or die(mysql_error());
echo "inserted";
}
$_POST[id]
Moderator: General Moderators
-
mikelbring
- Forum Commoner
- Posts: 38
- Joined: Sat Jan 05, 2008 5:28 pm
Re: $_POST[id]
I am guessing you want to update a row so this is what the SQL would be
Code: Select all
$query = "UPDATE attendees SET payment_status = 'PAID' WHERE id ='{$_POST['id']}'";Re: $_POST[id]
can I also for example say WHERE id is $_POST[id] and name is $_POST[name] then insertmikelbring wrote:I am guessing you want to update a row so this is what the SQL would be
Code: Select all
$query = "UPDATE attendees SET payment_status = 'PAID' WHERE id ='{$_POST['id']}'";
Re: $_POST[id]
Nevermind for that last question, I answered myself.
Thanks mikelbring! Life Saver
Thanks mikelbring! Life Saver
mikelbring wrote:I am guessing you want to update a row so this is what the SQL would be
Code: Select all
$query = "UPDATE attendees SET payment_status = 'PAID' WHERE id ='{$_POST['id']}'";