Page 1 of 1

$_POST[id]

Posted: Tue Dec 02, 2008 8:14 pm
by radium35
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";
}

Re: $_POST[id]

Posted: Tue Dec 02, 2008 11:00 pm
by mikelbring
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]

Posted: Wed Dec 03, 2008 10:25 am
by radium35
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']}'";
can I also for example say WHERE id is $_POST[id] and name is $_POST[name] then insert

Re: $_POST[id]

Posted: Wed Dec 03, 2008 10:39 am
by radium35
Nevermind for that last question, I answered myself.

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']}'";