Wait for value in database before continuing script
Posted: Wed May 03, 2006 9:46 am
feyd | Please use
I thought this would display the contents of the page until the query in the while loop returned a result, then the while loop would break and the header() command would be executed, but the page remained blank until the while loop completed, at which point the header() command executed. The problem is that none of the contents of the page is displayed.
Is it possible to do what I am asking?
Thanks
Mark
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Is it possible to make a script check for a value in a database every x seconds, and then proceed with the script once it has been found? I have tried putting this at the end of the script:Code: Select all
Echo "Page content here";
$num = 0;
while ( $num == 0 ) {
sleep(5);
$query="select * from messages where recipient='$username'";
$result=mysql_query($query);
$num=mysql_numrows($result);
}
header("Location: messages.php");Is it possible to do what I am asking?
Thanks
Mark
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]