Jump to content

Question About Page Refresh's after a mysql statement


JosiaMFire2

Recommended Posts

Ok, basicly my page looks like this (I wont use technical details). The problem is page refresh problem.

Note all syntax is example and may/is inccorect.

 

$infoq = mysql_query("SELECT * FROM XXX;", $lid);

$Table = "<table><tr>";

while($info = mysql_fetch_array($infoq)){

     $Table .= "<td>".$info['XXX']."</td>";

}

$Table .= "</tr></table>";

 

if ($_POST['do'] == 'SUBMIT'){

   if(mysql_query("INSERT INTO XXX (XXX) VALUES ($_POST['insertthis']);", $lid){

      $errorlist .= 'Successfully updated table';

   } else {

      $errorlist .= 'Unsuccessfully updated table'; 

   }

}

 

echo "Hi<br>".$Table."<br><input name=\"insertthis\" type=\"text\"><input type=\"submit\" name=\"do\" value=\"SUBMIT\">".$errorlist;

 

 

 

 

Now I can always just add a header refresh below the lines " $errorlist .= 'Successfully updated table';" and " $errorlist .= 'Unsuccessfully updated table';" BUT the problem with this (the problem i am faceing) is that this will refresh, and will refresh the table..

the problem is it discards the errorlist information.

So basicly, I want to refresh the page without discarding the log/errorlog information.

I do not want this, how can I get around this? I would like to avoid sessions and cookies if possible.

NOW I am presuming that moving the create table bit CANNOT be moved below the create table bit. Please dont tell me to move it below.

The mysql_fetch_array part of the code MUST stay before.

Im not overly good at explainging things, questions are fine, as to what I mean  :P

Thanks, Josh

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.