Sleep(900) ? Delayed Query... ?
Trying to set a marker in a MySQL table on our Primary host (WAMP stack) indicating whether or not there is current User Activity -- ON THAT SERVER -- as a signal to remote Secondary -- tablet pc based servers to skip scheduled database synchronization with the Primary. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Delayed Email
I am being asked to send an email out after a form has been filled out and submitted. The requirement though is that this email gets sent out an hour after the form has been filled out. The user is also supposed to be directed to another static html page after they have filled out the form. Anyone have any clever ideas to get around the buffering issues that are caused when using the sleep() command? I would like to implement a PHP only solution if possible. Keep in mind that we are using a Sun Cobalt appliance with a limited PHP 4.0.6.
View Replies !
Filesystem Functions Delayed
information one receives from is_dir() is out of date. In SuSE Linux 9.1 Kernel: 2.6.5-7.111 Apache/2.0.49, PHP Version 4.3.4. the following script: ********$r*=*is_dir*($d1); ********echo*"isdir*(*$d1*)*=*$r"; ********if*(is_dir*($d1))*{ ****************$e*=*rename*($d1,*$d2); ****************echo*"rename*($d1,*$d2)*$e"; ********} .... ********if*(is_dir*($d2))*{ ****************echo*"destination*dir*$d2*already*exists"; ****************return*(3); ********} leads to: d1: /home/zbyszek/people/1/15523 d2: /home/zbyszek/people/1/17904 isdir ( /home/zbyszek/people/1/15523 ) = 1 rename (/home/zbyszek/people/1/15523, /home/zbyszek/people/1/17904) 1 .... d1: /home/zbyszek/people/2/200 d2: /home/zbyszek/people/1/15523 destination dir /home/zbyszek/people/1/15523 already exists !!!!!!!!!!!! ******** but the terminal shell says: zbyszek@jane:~/people> ls 2/200 1/15523 1/17904 /bin/ls: 2/200: No such catalog /bin/ls: 1/15523: No such catalog !!!!!!!!!!!!!!!!!!!!!!!!! 1/17904:
View Replies !
How To Perform A Delayed Search, PHP?
I'm trying to allow a user to search a site only every 30 seconds. I have seen this done with forums, but was wondering if there was a generic method involving PHP that enabled this function? I expect it involves ip address checking, but how does this work? Is the ip address stored in a MySQL database and every entry past the last thirty seconds is deleted?
View Replies !
Delayed Form Submission
I would like to spread my submitted articles so that instead of publishing them immediately they will be published, let's say every 1 hour. That way I can post 10 articles, for example, and have a new article every 1 hour from 7AM all the way till 9PM. Does anybody knows of a script or class that would allow me to do that?
View Replies !
Delayed Save Window
How do I display display a save window in order to save a file, after the page has loaded. Similar to the page at the following address: http://sourceforge.net/project/downloading.php?groupname=portableapps&filename=7-Zip_Portable_4.42_R2.paf.exe&use_mirror=switch
View Replies !
Delayed Table Alterations
I'm going to have a login page for my site for users to edit portions of information I have stored in some mySQL tables. These tables are then compiled together and converted to flat files for distribution. I wanted to know how I could set it up where the user submits his alterations to the tables but I don't want them to take affect until an admin accepts these alterations.
View Replies !
Generating A Page In Time-delayed Chunks?
Is there anyway of getting these 'sleeps' and 'echos' up to the client, so that a page is generated in timed stages. The code below might give a better idea of what I mean.. Rather than have the whole lot run on the server (sleeps and all) followed by a single http header with a big lump of HTML, I would like each chunk to be sent up seperately in a time delayed manner and appended to the current content in the browser. My (feeble) guess is that I need to send an http header with each one, but what do I put in it? <?php if($whatever){ $total = ($one + $two); echo "<br><br><b>I'm having a snooze</b><br>"; for($i=0;$i<5;$i++){ echo "<br>$i<br>"; sleep (1);} echo "<br><br><b><i>Total of $one and $two is $tot</b></i>";}?>
View Replies !
PHP Sleep()
I've been sitting for quite a while now, reading the sleep() manual and tried to turn the code upside down and inside out but nothing helps... I want the current page to wait a few seconds before it is directed to another ( after a successfull registration ). So i thought the best way to do that is to use sleep(). However, this does work to a certain point ... the current page waits for 5 seconds, but the text I want to show the user in the meantime doesn't show? Why? Without the sleep() and the header() it shows without any problem. Code:
View Replies !
Sleep()
I tried to make a script which would print a line of text at 1 line per second or whatever time i put. So i went ahead and tried this. PHP Code: echo "Passwords match."; sleep(1); echo "Passwords match."; sleep(1); echo "Passwords match."; sleep(1); echo "Passwords match."; This is a example and the text in echo has no meaning. However the sleep waits and waits for all the other sleeps to finish and then prints out all text at once.
View Replies !
PHP Messaging And Sleep
I would like to get my php script to send a message to a user for example to notify that a DB update or insert has been successful or not. After that the script will be redirected to the home page. how can this be done ? I have tried using sleep(5) to delay the script but that does not work the way that I want it to since it simply delays the execution of the ENTIRE script RATHER than a part of it !!
View Replies !
Sleep() In The Background
how much the sleep() which is set to no limit can consume the system resource. Could it cause to hang the server? I tried the following and couldnot see the server got busy. Although the browser seemed to be so, if I access to a different page, it responded very quick as usual. It's not a big deal, is it? sleep.php PHP Code: <?php set_time_limit(0); sleep(0); ?> fork_sleep.php PHP Code: <?php $str = "php -f sleep.php"; exec("$str > /dev/null &"); ?>
View Replies !
Fsocketopen & Sleep
I'm trying to setup a fsocketopen script to ping a site every 15 minutes or so and if the site is down, send an email. I'm thinking of using ignore_user_abort() to run the script in the background and sleep() for the time intervals. I'm not really sure how to script this out.
View Replies !
Sleep And Max_Execution_Time
I have the following code: $i=0; while($i++<15) { mail("rantsh@hotmail.com",date("d m Y H:i:s"),"This is email # $i "); echo "mandado $i <br>"; sleep(60); } Now, I know my server has a 30 second max_execution_time setting... nonetheless, this code runs successfully!!!. Now, this is actually better for me (for the application I need to run)... Yet I'm concerned of why it's being allowed to run for 15 minutes if max_execution_time is set to 30. Code:
View Replies !
Would I Use Sleep To Delay
I am making a site for a friend, but with his PHP it always renders too quick and I would like it to wait a bit for the rest of the page to load, otherwise its a bunch of annoying gaps and whacked alignment as the CSS and images load and it all just looks annoying as it loads. And it takes away from the order of of information outputted as it goes through the PHP when your focused on the tripped out layout.
View Replies !
Sleep Function
I'm playing about with delaying results of a PHP program. I want to print some results then wait for a few seconds and print some more. I have found the php sleep function however have a small problem. <?php echo ("The time in 3 seconds from page loading: "); sleep(3); echo date('h:i:s') . " "; ?> The above script is meant to print the top line, wait 3 seconds and print the bottom line. Infact, it starts, waits 3 seconds and prints all at once. Now from my understand from php.net it should not sleep untill it hits the sleep command in there.
View Replies !
Sleep For 10 Seconds Help
I am trying to run it will load an iframe for every entry found in my DB, I am trying to make it sleep for 10 seconds between each iframe with: PHP Code: sleep(10); PHP Code: $train = "<table width=800 bgcolor=F0F0F0 aling=center><tr><td colspan=4> $pages<br></td></tr>"; $i=0; while ($addall = mysql_fetch_assoc($res)) { Â Â Â Â if ($i/2 == ceil($i/2)) $train .= "<tr>"; Â Â Â Â $i++; $train .= "<td width=120 valign=top><BR><iframe src="potspace.php?u=$addall[intId]" width="400"></iframe>"; } $train .= "<tr><td colspan=4><br><br> $pages<br><br></td></tr></table>";
View Replies !
Session Timeout, Use Of Sleep Ect...
I have a custom script that uses sessions to track UID's. The only problem I have with the script is that the session times out in 1440 (min?) which I believe is 24 min. I was thinking that I could use php's sleep to hold off from doing a refresh until minute 20. Unfortunately, I have also read that using sleep can leave a server open to a DoS attack. I do not have access to the php.ini file to be able to change the timeout variable for the session. What is the best way to keep a session open without changing the .ini variable. Is sleep a good way do go about it, and if so, are there significant security risks in using sleep()?
View Replies !
Sleep() Affects The Variables?
could it be that the sleep() function affects my variables? When I set a very long delay time (1-3 hours) in my CronJob PHP4 script (of couse with a big set_time_limit) some of my variables go lost! But there's no problem with short times in the sleep-function (1-5 min). set_time_limit(86400); for($x=1;$x<5;$x++) { echo $x; //$x will be shown only one time sleep(7200);}
View Replies !
Need To Flush Before Sleep But I'm Blank.
I'm new to php and am converting a bunch of asp pages to php. Current problem : I am using a Submit button on a form to POST ( send the database variables ) to a php page that will send a personalised e-mail to each client. On the php page, I am looping through a database, compiling a message ( html format ), and mailing the message to my client. After the mail has been sent, I need to wait for 4 seconds before continuing with the next database record. I am using this code after the mail has been sent : echo "Mail Sent to : " . $row['CliName']; ob_flush(); flush(); sleep(4); Problem is, that nothing appears after I click on the Submit button on the first page's form ( the first page just remains on the screen ). Once the database has been looped, the entire (correct) output appears on my screen - but I need to see some sort of progress as it works it's way through the database.
View Replies !
Sleep() And Browser Load.
is there a way to get around the browser continually acting like they are loading when using sleep()? It says the page is still loading but it really isn't because we are causing a delay for some data on purpose with php. So it is for an intentional reason that we cause it. Many of us like using sleep(). Anyway to do it without the browsers showing the page is still loading? There must be a way, so many programmers for intense programming use sleep(), I can't imagine they have to deal with the browsers loading prompts whenever they do.
View Replies !
Staggering Execution With Sleep()
For my site, currently in development, I will be hosting some latest RSS picks from friend websites. To start with there will only be a couple, but eventually I hope to be sourcing from up to 50 partner blogs. Obviously, i dont want to make a request on every page load, so I would instead cache data from the past half hour/hour. I will be using CRON to schedule an update every so often, but having a single script making 50 requests one after the other then processing and storing the data may be taxing, especially if the outside server is slow. I thought about using sleep() to leave gaps between each request so that a sudden hogging of resources doesnt happen every hour. What are your views on this method? Is it feasable (and possibly even a good idea), or should I just get it all to execute in one go?
View Replies !
Resources Used When Using The Sleep() Function
I want to use the Sleep() function in a script that may run multiple times, but i dont want hte system to crash or be overloaded with scripts in memory. When the script enters a sleep mode, what happens to the script? is it resident in memory? if so could i experience the system bogging down if there were 100+ scripts resident in memory or are they just sitting there doing nothing until they run again?
View Replies !
SLEEP + Header Problem
I'm running a community website where I send out weekly newsletters to all of my clients. However, I'm sure my hosting provider wouldn't be so happy if I just FOR LOOP and send it all out at once. SO what I did was I just a SLEEP and a header mthod that triggers after every second, where the header sends out GET variables for the next iteration to fetch at which account I am currently at to send the next newsletter. Code:
View Replies !
Insert Sleep Every X Rows
i am trying to insert a sleep command in my loop every 100 rows, the below works for every 2 but if i try to sleep every 100 rows it will not work. if($i % 2) { sleep(5); } does not work [php] if($i % 100) { sleep(5); } [/php
View Replies !
Long Sleep() And Time-out's
The script I'm writing needs to wait a random amount of time (1-300s) between each iteration of a loop, eg. while(condition) { do something //wait between 1s and 5 minutes sleep(rand(1,300)); } Problem is, a browser times out if it doesn't get an answer within about 30 seconds. Is the idea of having a PHP script sleep for a longer amount of time incompatible with web applications? Any work-around?
View Replies !
Putty Processlist Command Sleep
I'm using php with mysql. I am connecting through putty and I run the command for processlist. Lately I am seeing many threads with the command "sleep" in them. My site and the database are running smoothly, but I am seeing up to 200-300 threads like this with the command "sleep". Can anyone tell me what may be causing this and how do I resolve it? Or is it normal to see this when your site grows to a certain size? Code: ......
View Replies !
Require_once And Fatal Errors... Automatic Sleep And Try Again Anyone?
I have a PHP page which loads OK 80% of the time. However the rest of the time I get the following error: Fatal error: Failed opening required 'DB.php' This really bugs me, especially since the only reason this is happeneing seems to be due to server load. I would like to add code so that instead of displaying the given error, the PHP code makes the HTTP response thread simply sleep a little bit (say 4 seconds), and then retry, and repeat until the file can be opened. It seems strange to me that server load would prevent the file from being opened. Anyhow, any ideas on how I can improve the situation?
View Replies !
SHOW PROCESSLIST "sleep"
when i view SHOW PROCESSLIST i always see command sleeps with some large times behind them.. can somone please tell me what that is and what that might be caused by? "Command" Sleep "time" 1585
View Replies !
Use Query Result Field As Query Key For New Query..
$query  = "SELECT ProjID, UserID, ProjDesc, file, OrigProj, OrigUser, ProjDate FROM projects"; $result = mysql_query($query); I would like to take the field 'UserID', and utilise it for a Query statement to my users table in my database, to read and fill in information to my table, which looks like this: PHP Code:
View Replies !
Execute An Update Query Based On The Results Of A Select Query
I'm trying to execute an update query based on the results of a select query... This doesn't work - any ideas? This is the code I'm trying to get to run (it updates all products which are set to arrive by a certain date if that date has arrived or passed - and there are products that should and should not be updated in the db this is being tested with...): Code:
View Replies !
Turn Select Query Result Into Hyperlink To Other Query
I have a query which gives results of selecting coursenames from a table called trainingtopics but this does so in a continuous bulk of text without any breaks between each record. my question how do I create line breaks between each record and also how can I force each query result to become a hyperlink which when clicked runs another query that gives details of that course. <?php $user = "root"; $host = "localhost"; $password = ""; $connection = mysql_connect($host, $root, $password) or die ("Couldn't connect to server."); $database = "courses"; $db = mysql_select_db($database) or die ("Couldn't select database."); $sql = "SELECT coursename FROM trainingtopics"; echo $sql."=sql<br>"; $result = mysql_query($sql) or die(mysql_error()); echo $result."=result<br>"; while($row=mysql_fetch_array($result)) { // NOTE this one ABOVE the echo echo "result found!"; echo $row[0]; } ?>
View Replies !
Accessing Query Data From Query Against Multiple Tables
I have a query that gets info from two tables in my database. How do I access the data from the query? I know how to use the mysql_fetch_assoc() when the query in question only pulls information from a single table. How do I do the same thing for multiple tables and then insert the necessary data into my page? Code:
View Replies !
PHP Update Query Mysql: Query Succussful?
I can't seem to successfully test an update query. Below is a piece of code that updates a statistics table. If row today doesn;t exist, a new day must be created. But this doesn't work... thank you for your reply. $today= date("Y-m-d"); $qq="update totals_r set hits_r=(hits_r+1), lang_$lang=(lang_$lang+1), cat_$cat=(cat_$cat+1), rating_$rating=(rating_$rating+1), bussite_$bussite=(bussite_$bussite+1) where date='$today'"; $result_6 = mysql_query ("$qq"); if (!$result_6){ /// IF !ROW_TODAY ==> CREATE NEW DAY $qq_2="insert into totals_r (hits_r, lang_$lang, cat_$cat, rating_$rating, bussite_$bussite, date) values(Ƈ',Ƈ',Ƈ',Ƈ',Ƈ','$today')"; $result_6_2 = mysql_query ("$qq_2"); if (!$result_6_2){ $err_msg_sql_6= mysql_error(); $err_loc_6="$PHP_SELF"." // Query6: update totals_r"; } }
View Replies !
Speeding Up Query/code (query Within Result Set)
I'm looking for ideas on how to speed up this script. Basically it finds all the zip codes in a zipcode table, then looks for all the records in another table with those zip codes. Right now it finds all the zips then within that WHILE, it looks for a record in another table with that zip: PHP Code:
View Replies !
Query - Create The Mysql Query To Get All Fields
I've a table "article". Any article is of a type in table "type1" or "type2" Each type may be of a model in table "model1" or "model2". Each model can be on a certain make, also in 2 tables, "make1" and "make2". they are a few possibilities. "article" can be of "type1" or "type2" "type1" can be of "model1" only - "type2" can be of "model1" or "model2" "model1" can be of "make1" only - "model2" can be of "make1" or "make2" "article" has "type.id" field (char10). If it start with "my" then it's a "type2", otherwise is a "type1" "type1" has only "model1.id" field. "type2" has "model1" and "model2" fields. If one is filled, the other isn't "model1" has only "make1.id" field. "model2" has "make1.id" and "make2.id" fields. If one is filled, the other isn't so here are the possibilities: article -> type1 -> model1 -> make1 article -> type2 -> model1 -> make1 article -> type2 -> model2 -> make1 article -> type2 -> model2 -> make2 Now, I must create the mysql query to get all fields given the "article.id". Is it possible ? How ? will this work ? in pseudo-code article left join type1 articleid = type1id inner join model1 type1id = model1id //inner because if type1, the model is 1 inner join make1 model1id = make1id //inner because if model1, the make is 1 left join type2 articleid = type2id left join model1 type2id = model1id left join model2 type2id = model2id left join make1 model2id = make1id left join make2 model2id = make2id
View Replies !
Using Query Result To Do Another Query In Loop
I have 2 tables, one called users2 and one called books. Books has a field called UserId, which is the ID of the user that added the book to the database. My problem, is that i need to take this ID from the book table, and use it to get some information from the user table. Here is my code to get the ID from the book table: Code:
View Replies !
MySQL Query - 2 Steps In 1 Query?
I have two tables and the first one contains 2 main fields- 'user_id' and 'username'. The second table contains 2 main fields- 'poster_id' and 'message'. And what I need to do is lookup the user_id from the first table with the username, then pull * from the message_table if the poster_id matches the value pulled from the first table. Now, I got this working without a problem at all but I had to use 2 queries to do it (1- pull the user_id from the first table by matching it with the username, then 2- using the first id, pull everything from the second table that matches it). Is there an easy way to do those 2 steps in 1 query? I know there must be some way since this seems like a fairly simple and routine problem, but I can't find it online or in any books I have here.
View Replies !
Count Query In Mysql Query
Is it possible to retreave all data from 1 table. and count a number of records where 1 row has the same number as id of the main table? example Table categories id name 1 blah 2 hello Table Threads id name categoryid 1 first 1 2 mid 2 3 noon 1 4 blah 1 5 roar 2.
View Replies !
Re-query The Query Results
I'm querying a Mysql database & displaying the results. My code works fine. I now want to re-query the original query results. Therefore, I devised a crude method of dumping the original query results into a temporary table & querying the temporary table. I realised that this is not a good way of re-querying the query results because if more than 1 person is querying my database at the same time, then the records in the temporary table will keep changing. Code:
View Replies !
Query Inside Query
The query I built doesn't work properly... I need help creating a query.. but I've never done such complex query before, //Tables Cities(id, city) UserGroups(user, city, country) Users(name, country) I'm trying to list all the cities where users are from, and then count the users from the same city and display as follows: New York(12) Madrid(17) London(21) ... TIA
View Replies !
Math Query Within Another Query
I have 2 tables to pull some data from: Reports, and Judges The reports table simple holds the reports from a bunch of students, while seven judges grade each report on a scale from 1-7 in three categories. So, a report can get a high score of 21. My dilemma is to pull all the reports and show them on one single page - while producing a total sum of each category(from the judges scores) and the total sum of all categories(by adding all categories together). Code:
View Replies !
How To Know You Are At The End Of A Query
I am trying to figure out if there is a way for php to let you know that you have reached the end of a set of results for a given query, sort of like EOF... So let's say you have a query with a limit cluase of range x to range y. If in your query your range is say 20 to 40 but the query only returns 15 results, is there a way to report that the there are no more results to return?
View Replies !
Query Last 10.
how do I select the last 10 records from my db??? I explain, I am constructing my page and want to display on the first page the last 10 articles. I've been looking into MySQL from O'Reilly and found the LAST_INSERT_ID. I can't figure out how to construct a query with this. Is any other way to do?
View Replies !
Too Much Sql Query.
I have a script page with a lot of mysql queries. To load the entire page,the first time, the page employes about 20 seconds. When I refresh it, it takes about 0,5 seconds. I know there is a method to accelerate the pages with phpaccelerator but my page is in hosting and I don't have a private web server. What could I do? I think that it's covenient for me to generate a static html page from the php script and cache it for some hours. But how to do? Or there are other metods?
View Replies !
Query On Php.ini
I have a problem and I am getting the error "Unable to save result set". I've composed a search on the forums here and someone suggested increasing the available memory in php.ini - I'm not too good on things like this. Is this the right section in php.ini? memory_limit = 33554432; Maximum amount of memory a script may consume (32MB) I increased it to the above but I'm still getting the same mysql error. Should it go even higher? The server has 512MB of RAM. If that's not fixing the problem, any other suggestions for fixing the error "Unable to save result set" - I can't find anything on it when searching the MYSQL documentation.
View Replies !
|