Jump to content

Recommended Posts

Hope I make this clear.

 

I have an update code that will update several rows of a database table in one go. It works perfectly. The problem is that when update is pressed the page refreshes (without the new inputed data) and then the user is redirected as required (but the changed data is inserted into the database as required). This pause is confusing to the user.

Is there something I can do?

// Check if button name "Submit" is active, do this
if(isset($_POST['Submit']))
{
for($i=0;$i<$totalRows_PupilDataAll;$i++){//{
//Declare the variables to enter into the tables
$RA_colum[$i] = $RAcolum[$i];
$VAR_colum[$i] = $VARcolum[$i];

$id[$i] = $pupilID[$i];
/*
// Set the reading age column
$RAcolumn[] =  'RA_'.Year6.'_'.$month[]; //'1';//
// Set the Variance column
$VARcolumn[] = 'VAR_'.Year6.'_'.$month[]; //'1' ;//
*/
$reading_age[$i] = $_POST['scoredage'][$i];
$variance[$i] = $_POST['variance'][$i];

//Update the Reading ages table

// Insert data with columns passed from Current Year
$sqlRAupdate="UPDATE assessment_reading_ages SET $RA_colum[$i]='$reading_age[$i]', $VAR_colum[$i]='$variance[$i]' WHERE Pupil_ID='$id[$i]'";
$resultRAupdate=mysql_query($sqlRAupdate);
}
}
//If the update works go to this page
       //This is the bit where the pause occur....
if($resultRAupdate){
//header('location: update_select_groups.php');
printf("<script type='text/javascript'>
window.location='update_readingages_group_select.php'
</script>"); 

}
mysql_close();

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/51817-update-pauses/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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