By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

UPDATE a record in MYSQL DB with PHP

P: n/a
What is the best way to update a record in a MYSQL DB using a FORM and PHP
?

Where ID = $ID !

Any examples or URLS ?

Thanks
Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
James wrote:
What is the best way to update a record in a MYSQL DB using a FORM and PHP
?

Where ID = $ID !

Any examples or URLS ?

Thanks


$query = " UPDATE table_name
SET field = '$field'
WHERE ID = '$ID'";
$result = mysql_query($query);

Whatever you name your form element, put that variable name where $field
is... the contents of the element will be directly accessible by this
name once you POST if it is a textbox or list/menu, if you're using
radio buttons you can test what the value attribute is, and if you're
using checkboxes you can use isset() to see if it was checked.

Marcus
Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.