RynMan Posted May 16, 2009 Share Posted May 16, 2009 Hey guys I'm guessing this is probably pretty simple for anyone who's not a PHP rookie. I have my database, and I'd like to be able to create a page with a form, whereby the user can modify the values for that particular record in the database. I'd imagine I'll use the 'mysql_query' function to call the query based on the ID carried across from the previous page. From there, I'm a little stuck. I'd like this page to have all of the fields from the query (*), and the value currently in the database in the fields, for that particular ID. I noticed the 'mysql_fetch_field' function, but how do I then have the data for that field and the specified record (in the query) as well? Thanks for any help you can provide! Quote Link to comment https://forums.phpfreaks.com/topic/158346-field-name-data/ Share on other sites More sharing options...
RussellReal Posted May 16, 2009 Share Posted May 16, 2009 ok.. try to follow me your first page will most likely have links like Entry 01 | EDIT | DELETE Entry 02 | EDIT | DELETE for the entries, make the links look like <a href="edit.php?row=ID_NUMBER">EDIT</a> then in edit.php do this: <?php // establish connection and pick a database $q = mysql_query("SELECT * FROM `the_table` WHERE `id` = '".mysql_real_escape_string($_GET['row'])."'"; if ($r = mysql_fetch_assoc($q)) { print_r($r); } ?> on edit.php use $r to display the information and on submit send it to amend.php or w.e via POST and then use mysql's UPDATE Quote Link to comment https://forums.phpfreaks.com/topic/158346-field-name-data/#findComment-835117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.