Here's a weird one:
I have a script with a form which inserts to a table. The processing is this:
Script 1
1) Row A inserted to table
2) Form displayed
3) User fills form and clicks submit
4) Same script is re-entered
5) Row B written to table
6) writes javascript to set location to new script
Script 2
1) Query table
2) Script returns Row A, but NOT row B - even though it's there.
I'm sure it's something to do with the method I'm using to start the second script:
echo "<Script language=\"javascript\">window.location=\"script2.php\"</script>";
If I hit refresh after the second screen is displayed then the SQL query returns both rows. If I take out the redirection and let the first script display what's on the table (using exactly the same sql) then it also returns both rows.
I wonder if it's something to do with caching or whether using the javascript is causing PHP to think it's in the same script and the insert hasn't commited or something ?
Anyone seen this before ? Any idea if there's a better way to change the current URL from PHP ? Any idea for a workaround (I
suspect that getting the second page to refresh immediatly will solve the problem).
I really like PHP, but the little funnies are driving me insane
😃
Nick