Jump to content

Field Name + Data


RynMan

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.