How To Calculate The Running Time
The start and end times for a tv show or film .
17:50
18:30
40 minutes running time
23:50
00:30
40 minutes running time
23:50
01:40
110 minutes running time
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Running A Script All The Time.
I have a PHP script, which connects a bot to an IRC Network. This script works great (for statistics and so forth), and I can launch it either by loading it in my brower, in which case it never stops loading - anything "new" is sent live to my brwoser, so that's not ok. I then SSH'ed to the machine and used "php bot.php" which loaded the script fine, however, if I close my SSH session the bot dies. Likewise, if I do ctrl+c while in the shell, the bot dies also. I tried using (at someone's advice) "./php bot.php &" which returrned that PHP was an unknown file or directory. Code:
View Replies !
View Related
Limit To Script Size Or Running Time??
I have been working on a script for a couple of days and I thought I had finally completed it but it seems to be stopping for no reason? Is there a limit on the running time for a script or the size of the html page it can generate? The script grabs the source from a webpage off thw web and extracts some data from the page and also a series of sub pages linked from it. It takes all this data, checks whether it is already in my database and adds if it is not going to duplicate anything. All of this bit works fine but it was the last bit that I have just completed which seems to be making the script stall half way through. The data is listed over several pages with a next page link at the bottom. The script checks to see if there is a next button and if so loops back through the script for the next page. When I run the script with this addition, it stalls half way through the second page. If I let the script run and comment out all the processing part of the script, it works fine and loops through all of the pages?
View Replies !
View Related
Session Problem With Multiple Scripts Running At The Same Time
I've noticed a rather interresting problem with sessions and multitasking scripts.. Let's say I've got 2 frames and both running a program that prints 1000 dots at rate of 1 per second. Pretty simple. And this works, great. Both frames print dots at the same time. So this is the the problem: If I put session_start(); in these scripts (or have session.autostart defined), the other script doesn't start until the first one finishes. Does PHP lock the sessionfile while executing the script or something and script waits until the lock's released? Has anyone figured where the problem is? It would help my project very much if I could use session while running the script.
View Replies !
View Related
Multiple Scripts Running At The Same Time Cannot Execute Session_start().
I'm writing an application that has an over-abundance of AJAX. I have a central script that the user interacts with, and several scripts are called via AJAX request to do various things. It seems however, that multiple scripts running at the same time cannot execute session_start(). Like, If I have one script that is running on the server, that is using sessions, and then kick off another script, the second one will not proceed until the first one is finished. I need them to run simultaneously. It appears that session_start puts some sort of mutex on the session file on the server, and locks it from multiple access. That makes sense. Am I interpreting the problem correctly and is their a way around it. I don't want to have to use plain old cookies.
View Replies !
View Related
Warning: Invalid Argument Supplied For Foreach() Running On A OS X Machine Running Apache 1.x And PHP 4.x.
The following script was running on a OS X machine running Apache 1.x and PHP 4.x. I just moved the script over to a Linux machine running Apache 2.0.51 and PHP 4.3.8, and now the foreach line does not work. It says Warning: Invalid argument supplied for foreach() in /var/www/localhost/htdocs/warehouse/whse_order_submit.php on line 39 Here is the script: <?php //get the variables from the other page $id=$_POST['id_no']; $sku=$_POST['sku']; $description=$_POST['description']; $order=($_POST['order_qty']); $store=$_POST['store']; $comment=$_POST['comment']; $ip=$REMOTE_ADDR; //check if store is empty if(empty($store)) { die("Store is required. Please press the back button and enter in your store."); } //connect to the database require('../inc/database_conn.php'); //$month=getdate(mon); //$day=getdate(mday); //$year=getdate(year); //$today=$year . "-" . $month . "-" . $day $today=date('Y-m-d'); // create the unique order number $headerqry = "INSERT INTO misc_order_header (order_date, store, comment, ip) VALUES ('$today', '$store', '$comment', '$ip')"; mysql_query($headerqry, $conn) or die(mysql_error()); $order_no=mysql_insert_id(); foreach($order_qty as $id_no => $val) { if($order_qty[$id_no] > 0) { $detailqry = "INSERT INTO misc_order_detail (order_no, id_no, sku, order_qty, order_date, store) VALUES ('$order_no', '$id_no', '$sku', '".$order_qty[$id_no]."', '$today', '$store')"; mysql_query($detailqry, $conn) or die(mysql_error() . "<BR>" . $detailqry); } }
View Replies !
View Related
Calculate A Value That Is In The Db
i want it to calculate a value that is in the db if the db has the value 6 pound(s) (i have a submit button) and the users enters in the input box a value for more pounds then how do i make it calculate in fractions or even divisions.. cause see this is what i have. PHP Code:
View Replies !
View Related
Age Calculate
I need to run a query if a user age is within specified age range. User age is store in a table in 0000-00-00 format the age limits are passed by two vars: PHP Code: $ageMin = 25; $ageMax = 35; I can do it in a php function but I'd like to perform this validation in a query string. Is it possible?
View Replies !
View Related
Calculate Date
I have a date 11-07-2007 22:06 and i want to know how to calculate 4 hours ahead and create a count down system $date_now $date_4hours $countdown = $date_now - $date_4hours;
View Replies !
View Related
Calculate The Percentage Of 250 Between 150 And 450
Say I have two numbers, for example 150 and 450....and a third number between them, say 250. I want to calculate the percentage of 250 between 150 and 450, where 150 is the 0%, and 450 is the 100%. I know there is a certain formula, but seeing math was never my favorite course, I can't just figure it out.
View Replies !
View Related
Calculate Months
I would like to make the login form so that you can only have so many failed login attempts. For example, I would like to make it so that if you fail to login correctly after 5 attempts, you won't be able to for 10 minutes.
View Replies !
View Related
Best Way To Calculate A Rating?
ive got some code which ive written which takes 5 values from a database and calculates the average then displays the average as a certain number of stars. the code works perfectly so there is nothing wrong.. its just a bit long and i was wondering if theres a qicker easy way to do the same thing? or if i should just stick to what ive got. Code:
View Replies !
View Related
Calculate Many Downloads
I want to know how many successful downloads from website, is there some PHP script can do this? Let's say I have file "abc.zip" people can download, The system is Apache+linux+php+mysql, how I can know exact how many successfully downloads and the download time. I know it can be done by weblog statistic, but I want to know is there some way in php can do it so I can save in database and view real time result.
View Replies !
View Related
Calculate Cost
I have an equipment table. In this table there is an onhand, receivedqty, and totalcost fields. How can I query to get an average cost and extended cost. The math would be totalcost/receivedqty=averagecost and the extended cost would averagecost*onhand. Is it possible to do the equations within the mysql statement. I tried the below but it won't let me use average to get the extended cost.
View Replies !
View Related
Calculate Days Worked
I have a set date in my MySQL database that records when a Sales Lead is established and I echo that date as $row_rsLead['lead_date']; I need to be able to calculate how many days that lead has existed. $row_rsLead['lead_date']; outputs as 2007-06-14. I have made numerous attempts to create a function that will calculate the days between the lead_date and today's date, but have made absolutely no headway. I am either stuck working between differing date formats or really strange numerical outputs. If there is a script someone is willing to share or point me in a direction that is good for a relative newcomer to PHP,
View Replies !
View Related
Calculate Volume Discount
I'm trying to create a calculation that will look at the qty ordered and compare that to the quantity discounts. An example is as follows. Product = Bronco wild horses 1,000(horses) = $300.00/m 2,000 = $150.00/m 3,000+ = $100.00/m etc. /m=per thousand So if I order 2500 horses the php page will look at the value entered, select the proper price and calculate the final total. 2500/1000=2.5X$150.00=$375.00 for 2500 Bronco's. As you can see below, I've got the formating for the final total, But I don't know how to have it find the right price. Code:
View Replies !
View Related
How To Calculate The Day Of The Week By A Given Date.
I'm currently working on a (simple) calendar system which allows registered users to add an event to the calendar. The table EVENT stores info about the author, date and description of the event. I then managed to output a list in which only events of this year are showed and are grouped together by months. And now I only need one more thing to complete the script. I want to output for every event on which day of the week it occurs (monday - sunday). I've looked around for tutorials but haven't found a basic one.
View Replies !
View Related
Calculate Crc32 Of File In Php
I am having a problem calculating a crc32 hash of a file in php. I have uploaded a file, calculated an md5 hash and it is correct, both using md5_file() and hash_file("md5",filename) and they are both correct (tested with md5 command on osx and MD5 in Java). I am using hash_file("crc32",filename) and this gives a different result to crc32 in Java and crc32 command on osx.
View Replies !
View Related
Calculate A Firefighters Schedule In PHP
I need to calculate the following schedule in php. What I need out of the script is what shift is working “today” E.G. $shift = d;. There are 4 shifts working 24hr days starting at 7 am. The days rotate on 28 day cycles. E.G. ‘C shift’ is working on July 1 (Sunday) the next Sunday they work is the 29th. I found some code that works with 3 shifts on a different cycle but I have 4 shifts. Code:
View Replies !
View Related
Calculate Totals In A Loop
I am trying to calculate the totals of all the fields pulled up in a loop... i.e. I have a database called "checkout" that has bidder numbers, lot numbers, and amount for each lot number. When a person wins an auction (this is a live auction not an online auction) we enter a new row in the database that has the bidder number, the lot number, and the amount. After the auction is complete and they are checking out we have the script pull all the rows where the bidder number equals the bidder who is paying, it displays their bidder number, and lists each lot number and amount for that lot on separate lines in a loop statement. I would like to have a final line at the end of the page that displays the total of all the amounts listed. I.e. if they have lot number 12 at $50 and lot number 10 @ $27 and lot number 55 @ $63 the script displays as follows... bidder number: 101 lot number 12: $50 lot number 10: $27 lot number 55: $63 And I would like the end to say total: $140 How can I do this? I appreciate any help... Here is a copy of what I am working with now. Code:
View Replies !
View Related
Calculate Percentage Discount
I have a field which holds a numerical value lets say 29.99 Based on whatever the value of this number is I then want to calculate 5% of the value Do I just do $discountPrice = $totalPrice * 5% Im not sure what syntax to use to achieve this
View Replies !
View Related
Calculate Dates Given Beg And End Date
I am trying to figure out how to generate a listing of dates using the following known values: begDate = 2007-07-03 endDate = 2007-08-30 recurDates = Tue|Thu Question is how do I generate the YYYY-MM-DD for each of the dates between begDate and endDate for each of the recurDates?
View Replies !
View Related
Calculate Difference Between Dates
I've to build a function that tells me the resultant date from adding a number of days to a date. Example: function adddate(date, days) { return date + days; } For example if I call with this...adddate(2007-05-05, 5) it should give back a 2007-05-10. I've tried but is hard! It should work with any number of days.
View Replies !
View Related
How To Enumerate And Calculate Timezones?
In a web database (PHP), per user, I'd like to allow each user to specify their timezone (this would change how times are adjusted for display for that user). How do I enumerate all possible timezones from a PHP script or compiled 'C' program? Given a specific timezone, how do I get the time adjustment from UTC (which can vary, based on daylight savings rules)? Code:
View Replies !
View Related
Calculate And Show % Saved
I would like to thank you guys in advance for your time and help offered. I am trying to setup a page that will multiply any number entered by user with a specific cost and display the sum as well as percentage saved, all on the same page (or even in another frame). Secondly I need this keyed number to be used as the default for the payment page that follows. Basically i want to show my customers what they save before they get to payment page.
View Replies !
View Related
Calculate Color Proximity
I want to compare 1 color (hex or rgb) with a list of colors and choose the more similar of the list. For example I have #FF1202 and an array with: array ("FF0000", "00FF00", "0000FF" ...); I need to find the color more similar in the list (in this case the first: FF0000).
View Replies !
View Related
Calculate Bandwidth Usage
When a user registers to my site, I give him a folder to create his web presence (free hosting). Is there a way to calculate the traffic usage of his folder contents? They could be anything from text files to movies and flash.
View Replies !
View Related
One Query To Calculate Stock
I want to calculate my stock. the formula is : end of stock = beginning of stock + purchase - sales (I make it simple ... so I didn't include 'stock return' and 'stock opname' etc) My stock table is : prodid (varchar) bos (double) -> beginning of stock Purchase table is : date (date) invoiceID (varchar) prodid (varchar) qttybuy (double) Sales table is : date (date) invoiceID (varchar) prodid (varchar) qttysales (double) How to calculate my 'end of stock' using just one query.
View Replies !
View Related
Calculate The Number Of Days
I am trying to calculate the number of days a house has been on the market. I am using this: CURDATE( ) - listDate I thought this was working fine until I added records with a list date starting the month prior. for some reason 13 day olds were showing as 83, 14 days were showing 84, and so on. All adding 70 days.
View Replies !
View Related
Calculate Total Value Of Rows
I am pulling data from a MySQL database. I want to print out all individual rows, then total them. My use of arrays and sum of those arrays has me baffled. I want to print out one total value that sums all data from field "sales_total" The following prints the LAST row in the result set only. <? $result = mysql_query ("SELECT query goes here"); $myrow=mysql_fetch_array($result); if ($myrow) { print "<ul> $myarray = array($myrow ["sales_total"]); $sum = array_sum($myarray); ........
View Replies !
View Related
Fedex Calculate Shipping Rate
Does anyone know how to calculate the shipping rate on Fedex? There was a web module to handle the web query for rate at Currently it is not available, I wonder if there still has a similar module like that. I did some search on the Fedex sites and find out they have several API and I do not know which one I should choose. Could anyone give me some up to date idea on that?
View Replies !
View Related
Calculate A Number And Output It As An Image Using Img Tag?
Is it possible to point to a php file from an image tag like so: <img src="http://otherdomain.com/getNumberOutputAsImage.php"> which would go to the php file, do its calculations, determine a number, then output that number as a graphic? Do you know what I mean? P.S. now that I think of it, I have another thought. I heard that sites like doubleclick have their banner ads all over the place and using only the image tag, manage to set a cookie cross-multiple domains. Is this true? I have a couple of domains linked together and would love to be able to maintain the login state through a cookie. Is this possible?
View Replies !
View Related
Calculate Age Based On Date Of Birth
I am trying to validate whether or not a date of birth entered in dd/mm/yyyy format is between 16 and 69 years old. Suppose we have todaysdate = 18/04/2007 The minimum allowed date of birth would be 18/04/1991 and the maximum allowed date of birth would be 18/04/1938. I have looked at using strtotime but this only does dates from 1970 (I think)
View Replies !
View Related
|