468,110 Members | 1,867 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,110 developers. It's quick & easy.

UPDATE a record in MYSQL DB with PHP

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
1 8470
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.

Similar topics

2 posts views Thread by Mark | last post: by
2 posts views Thread by Reply via newsgroup | last post: by
19 posts views Thread by Westcoast Sheri | last post: by
reply views Thread by Fraser Hanson | last post: by
5 posts views Thread by jayson_13 | last post: by
9 posts views Thread by zMisc | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.