Jump to content

Query MySQL Data and Display/Edit on PHP page.


SalientAnimal

Recommended Posts

Hi guys,

 

My question here is pretty simple. I am struggling to get a PHP page to Query my MySQL data base and to display this on the page in a table. In addition to this, I would like to be able to edit the data in my table from the returned results.

 

i.e Next to each result row ther should be an edit link, when clicking the link it opens the data and allows you to edit it and then submitting it to the data base to edit the entry.

 

Another Question I have is how to capture an image, i.e scanned in document to a MySQL database. I would like to create a form that captures a name, surname, email address,  and finally the image or any other file format.

 

I have started working on the code form my second question, but do not have now to include on this post. Will update that ASAP.

 

Thanks

Guys

Link to comment
Share on other sites

pseudo-code . . .

 

Display records

while( $array = mysql_fetch_assoc( $result ) {
  echo $array['field1'] $array['field2'] $array['field3] . "<a href=\"edit_page.php?id=" . $array['primary_key_field'] . "\">Edit Record</a><br>";
}

 

Then use a form to process the data. Query the db for the record requested in the $_GET var, and display the results in form fields appropriate for the data type (probably text for most of them). You can use the same script to run the UPDATE query simply by checking to see if it has been submitted to itself.

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.