• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

Php Mysql Ajax Inline Update

Hi folks, a new question:

I need to make a search with certain parameters and I want to be able to edit the result list in line, but I have not being able to make it work...

Any help would be greatly appreciated.

Rodric MacOliver
Rodric MacOliver
  • 2
2 Solutions
Ray PaseurCommented:
Please show us what you are doing by using the SSCCE.  We need to see your test data and the exact output you want to get from the process, along with any code you have already written.  I am sure that once we have the test data and the expected output we can offer some guidance.
Rodric MacOliverResearcherAuthor Commented:
Ray, I tried several of the already developed like the Jeditable, but since JQuery is a novel experience for me I stumble on almost everything...

If I could get a simple example explained I think it would be extremely helpfull...

What I want is to receive a response from a query like one or a couple of records from an MySql database and the listed results be editable...

Thanks for the atention...

RobOwner (Aidellio)Commented:
It would really help to show us what you've already got.

I'll cover the basics below but you will need to improve upon them to suit your needs.

the basics for the search are:
a form with a textbox and submit (search) button
<form method='post' action='results.php'>
<input type='text' name='search' />
<input type='submit' value='submit' />

Open in new window

This posts to your php and i'm not going to go through
<form id='edits' name='edits' action='update.php' method='post'>
// use $_POST['search'] and query your database
// output the results to a div within any structure you link eg <table> whatever
// make sure the id of the div will be unique and match a unique id in the db
<input type='submit' value='submit' />

Open in new window

The javascript for the above page (using jQuery to make things easier)
$(document).ready(function() {
   $('#edits').find('div').click(function() {
      // each time a div is clicked hide the div, create an input element with the div contents
      $(this).hide();  // hide the div
      $(this).parent().append('<input type="text" name="'+$(this).id+'" value="' + $(this).text() + '"');

Open in new window

then when you submit the form to update.php you take the values in the $_POST global and update your database.

This is a very simplified version given you have provided no code.
Ray PaseurCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now