|
Posted by J.O. Aho on 07/18/07 04:24
Ronald Schow wrote:
> The page I want to update is similar to "http:www.hospiceslo.org/events.php"
> (read only). On my update page I've got the same table as a FORM where the
> client can make changes to the fields. The problem I'm having is updating
> the MySQL data base with the content of the form. I have no clue and would
> like to know where to start. Can I get some pointers to references or
> examples, even suggestions, on how this can be successfully done?
Without checking what the user has sent
//assume you have already connected to the database
//if not see the online manual for mysql_connect()
$query("UPDATE tablename SET column1='{$_REQUEST['column1']}',
column2='{$_REQUEST['column2']}', column3='{$_REQUEST['column3']}' WHERE
keycolumn='{$_REQUEST['keycolumn']}'";
mysql_query($query);
In your form you have a hidden field keycolumn which has the rows primary key
value and then you name the options that the user can update for column1,
column2, ...
--
//Aho
Navigation:
[Reply to this message]
|