I am running a db query and display the results on the same page. even tho I run the query before I load the page, I have to refresh before it updates my table. Is there a way to delay the update of the table tell the query finishes?
On the top of the page I have
if (isset($_POST['record']))
{
$user->delete($_POST['record'],1);
}
?>
Lower in the page I have a table that displays a list of users. When I delete a user it runs a form
echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\" > " ;
echo "<input type=\"hidden\" name=\"action\" value=\"delete\" />";
echo "<input type=\"hidden\" name=\"record\" value=\"".$found['id'] ."\" />";
echo "<a id=\"deleteRecord\" class=\"btn btn-danger\" href=\"#\"><i class=\"fa fa-trash-o\"></i>
The table that contains the form is what I need updated. but after I delete, it loads the table as if the record still exisists. (it is gone in the database) and I have to do a second refresh before it removes the record.
I also tried do do a refresh as part of isset(POST) and it works sometimes. but I think there must be a better way