Rohlan Posted April 24, 2009 Share Posted April 24, 2009 Hi! Right now all I'm doing is running a couple of tests to decide if what I'm trying to do can be done this way: I have a while loop doing this: while($row_email = mysql_fetch_array($result)) { echo $row["my_field"].","; sleep(10); } This is echoing: "0,0,0," because there are 3 rows in my table and all of them have a value of "0". I put the sleep(10) there because I want to be able to change the value of one of the fields while the script is "asleep", so that it echoes that value out the next time it loops. So if I were to change the value of "my_field" to "1" after 1~10 seconds, it would echo "0,1,1," or something similar. Basically what I want is to change the values that will be echoed after the script is done processing while the script is running. Right now, theoretically, what I have should be enough right? am I missing something? Is this simply impossible? does sleep() not work the way I'm seeing? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/155451-solved-sleephm-sorry-for-being-vague-hard-to-explain/ Share on other sites More sharing options...
mikesta707 Posted April 24, 2009 Share Posted April 24, 2009 all sleep does in this case is wait 10 seconds each time it loops through the entries to continue looping. How exactly are you changing the values? if it is in that script than having it sleep is entirely useless, because the PHP can't do anything while its "asleep" I really dont understand what you wish to accomplish here Quote Link to comment https://forums.phpfreaks.com/topic/155451-solved-sleephm-sorry-for-being-vague-hard-to-explain/#findComment-817994 Share on other sites More sharing options...
Rohlan Posted April 24, 2009 Author Share Posted April 24, 2009 I am changing the values through phpMyAdmin, forgot to mention, that is where $row["my_field"] comes from Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/155451-solved-sleephm-sorry-for-being-vague-hard-to-explain/#findComment-817996 Share on other sites More sharing options...
PFMaBiSmAd Posted April 24, 2009 Share Posted April 24, 2009 You would need to execute the query again to see any change in the database values because the result of the previous query is buffered in memory at the time the query was executed. Quote Link to comment https://forums.phpfreaks.com/topic/155451-solved-sleephm-sorry-for-being-vague-hard-to-explain/#findComment-817999 Share on other sites More sharing options...
Rohlan Posted April 24, 2009 Author Share Posted April 24, 2009 You would need to execute the query again to see any change in the database values because the result of the previous query is buffered in memory at the time the query was executed. And with this said I conclude that I did not know what was going on in the background Thanks, that worked! Even if I now have an extra query per item... hehe.. I'll live. Quote Link to comment https://forums.phpfreaks.com/topic/155451-solved-sleephm-sorry-for-being-vague-hard-to-explain/#findComment-818004 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.