$_POST[id]

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!

Moderator: General Moderators

Post Reply
User avatar
radium35
Forum Commoner
Posts: 50
Joined: Mon Nov 10, 2008 5:05 pm
Location: USA
Contact:

$_POST[id]

Post 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";
}
mikelbring
Forum Commoner
Posts: 38
Joined: Sat Jan 05, 2008 5:28 pm

Re: $_POST[id]

Post 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']}'";
User avatar
radium35
Forum Commoner
Posts: 50
Joined: Mon Nov 10, 2008 5:05 pm
Location: USA
Contact:

Re: $_POST[id]

Post 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
User avatar
radium35
Forum Commoner
Posts: 50
Joined: Mon Nov 10, 2008 5:05 pm
Location: USA
Contact:

Re: $_POST[id]

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