0

I am pulling in values from MySQL into a php page like so:

$query = 'SELECT cinfo.`client_id`, cinfo.`client_first_name`, cinfo.`client_last_name` ';
$query.= 'FROM `client_information` AS cinfo ';
$query.= 'ORDER BY cinfo.`client_id` ';

These are being displayed within a table that has a loop for each row:

$result = mysql_unbuffered_query( $query );
echo "<table border='1'>";
    echo "<tr>";
    echo "<th>Client ID</th>";
    echo "<th>Client First Name</th>";
    echo "<th>Client Last Name</th>";
    echo "</tr>";
while ($row = mysql_fetch_assoc($result))
{   
    echo "<tr>";
    echo "<td>" . $row['client_id'] . "</td>";
    echo "<td>" . $row['client_first_name'] . "</td>";
    echo "<td>" . $row['client_last_name'] . "</td>";
    echo "</tr>";
}
echo "</table>";

I have also set up an update/delete script in a separate file, assuming that on 'update' or 'delete' variables storing the info will be passed to that file and run an update to the client's information based on the ID.

My lack of knowledge is the asynchronous aspect of submission, and I am having trouble incorporating javascript/jquery into the results to edit and update the values stored within the database without a page refresh. Does anyone have an idea on how to best accomplish this?

Essentially I'd like the page to act as shown below:

Info as pulled from MySQL: Info as pulled from MySQL

After the user clicks "Edit": Editing information

Information after update: Updated information with notification

Demir Oral
  • 65
  • 8

1 Answers1

1

AJAX will do the trick for you.

Check these out: jQuery POST and jQuery Ajax POST examples.

Community
  • 1
  • 1
Mahdi
  • 9,247
  • 9
  • 53
  • 74
  • Thank you, I will take a look at your links and see if I can incorporate the logic! If anyone else has any information for me, I would greatly appreciate it! Thank you! – Demir Oral Feb 21 '13 at 05:42