javascript - Run a php line again after updating a row in the database -


if possible run again php line after update table in database?

i have html button fire jquery.post:

btn.onclick = function(e) {     $.post('inc/pstpts.php',           {               pts: pts           }); } 

in pstpts.php make query , update target row success. had loaded row in html this:

<?php      ($i=0; $i < $q->query_numrows(); $i++) {      print '<tr><td>' . $d[$i]['user_nom'] . ' ';     print '<tr><td>' . $d[$i]['user_ape'] . ' ';     print '<tr><td>' . $d[$i]['user_email'] . ' ';     print '<tr><td>' . $d[$i]['user_cel'] . ' ';        } ?> 

but had loaded old data.

i want run 5 lines after update.

since have less code, post pseudocode give idea.

server side:

//get inputs $_post  // update database  $update = $db->update($_post); //simplified. example  if($update !== false) {    $entry = $db->query("select * foo ...... id = $_post['id']"); //take care of sql injections.    foreach($entry $i)   {       //build html , echo   } } 

note: bind params (to make query safe sql injection), follow examples in binding links

client side:

$.post({   //url }).done(function(data){       $('#selector').html(data); }); 

done....


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -