Leave Calculation
for example, for the first 2 years, he does not has bonus leave, on the third year onwards, he has 1 day increase. by default, he has 18 days leave, on the third year, he can carry forward the 10 days from the previous year, now, he has 28 days leave plus 1 day bonus leave = 29 days. same with the fourth year, he can carry forward 10 days, so, he has 39 days leave plus 1 day bonus leave = 40 days.
if he apply 2 days leave in the first 2 years, the balance is 16 days. on the third year, he only can carry forward 10 days only, not 16 days. if he apply 12 days leave in the first 2 years, the balance is 6 days. on the third year, he only can carry forward 6 days only, not 10 days. this is the problem that u don't know how to fix, can you teach me?
View Complete Forum Thread with Replies
Related Forum Messages:
Is It Better To Echo Or Leave As Html?
I have a multi step signup form that I'm building and I have the following question. Should I do it this way: <?php if (blah == 1) { ?><table><td width="100">........etc <?php } else { ?> <table><td width="100">........etc <?php } ?> OR <?php if (blah == 1) { echo "<table><td width="100">........etc"; } else echo "<table><td width="100">........etc"; }?> If the second way is better is there an easier way to convert the HTML rather then writting echo a million times by hand?
View Replies !
What Special Characters Can You Leave In A Name?
I am designing a membership system for my site and I want as few bugs as possible, so I wanted to know from all of you what you think is okay to leave in a name, with relevance to spaces and special characters. Also, I cant seem to find a good piece of code that can detect the characters so I can notify the user that they cant have those in their name! Anyone know a good way of doing this?
View Replies !
Logging A User Out When They Leave Your Website...
I have been recently trying to implement a member interaction into my database. Right now I have it so they log in and it sets a column named "Logged_In" to "Yes" for their username, I can't seem to figure out how to Log them out when they leave. I tried to use the onUnload event in the body tag and popup a quick popup (which I didn't really want to do but only thing I could think of). But that will pop up a window every time you go to a differant URL (on the same domain). I'm mostly wondering if there is a way to have session, and detect if it expires. And when it does then update the database to set that column to = "No", or whatever, if so, how would I go about doing this. Or anyone know of a better way, and have some experience with anything like this?
View Replies !
Modifying 'for... Loop ' With Php To Leave Out One Number
Im using the following loop to populate a list box but I dont want the current selected value (from database) to show in the list The one I want to omitt is in the variable: $row['bbannerorgfont'] I wish to some how include this in the below loop to the effect of echo from 0 to 6 except for $row['bbannerorgfont'] VB has select...case... etc. Is there something similar with PHP? <? for($i = 0; $i < 7; $i++) { echo "<option value='".$i+1."'>".$i+1."</option><br>"; } ?>
View Replies !
Leave Quotes In Img Tag When Using Strip Tags
using strip_tags to strip a bunch of stuff out but what I want to leave is " quotes in tags there is a img tag <img vspace="4" hspace="4" border="1" align=right alt="" src="http://www.example.com/image.gif"/> after running I am left with <img vspace=4 hspace=4 border=1 align=right alt= src=http://www.example.com/image.gif /> how can I leave the closing "" around the tags, ie alt=""? Here is my strip tag cmd while($input!= strip_tags($input, '<b><i><em><strong><img><br><blockquote><object><param><embed><p><quote>')) { $input = strip_tags($input, '<b><i><em><strong><img><br><blockquote><object><param><embed><p><quote>'); }
View Replies !
Leave An Http Request Hanging With Php
so spammers have been hitting my site using php, is there a way to just stop responding to the spammer? instead of banning their ip and returing a 403, i want to just leave them hanging, and let them wait forever for the site to respond. can this be done in php? i know exactly which visitors are spammers. unless you guys can suggest a more malicious way to deal with them using php i would like to hear it too. ideally i would like to get them to stop hittng my site because it is screwing up my stats and logs, even the 403 connections are logged.
View Replies !
How Not To Leave Empty Spaces On The Page
I am making a form that when you enter the info the info it goes to another page. They can select as much or as little info as they want to on the form. So when it sends to the next page I want line breaks between all the variables, but if they choose not to select anything for that then I don't want a line break. I just want it skipped. How do I get it not to leave empty spaces on the page if they skip certain variables. I doubt I'm explaining this well.
View Replies !
Combining Two Queries, But Leave Them Separate (mySQL)
I know this might sound strange but i think(/hope) it's quite simple: I'm running 2 queries in a mysql DB, first one returns 20 results. Now how can i echo results from the second query in the 1st query's result, like: do{ echo 'foo'.$second_result['thingy']; }while($first_result = $first_query);
View Replies !
Regular Expression To Remove All The HTML Elements And Only Leave The Plain Text.
I am trying to take some HTML and remove all the HTML elements and only leave the plain text. Basically I am trying to extract information that was put into an HTML table. I have a regular expression which catches the HTML elements, it is <.*?> but I actually want the inverse of this, that regular expression returns the HTML elements to me, I want the plain text. I tried doing [^<.*?>]+ but square brackets will only work with 1 character at a time, so it is not seeing <.*?> as a whole.
View Replies !
Text Links To <a> Tags, But Leave <a> Tags
As the title says, all I need to do, is convert (maybe multiple) text links (eg. http://bla.com or ftp://bla.com) to plain simple html links (<a href="http://bla.com">http://bla.com</a>) I have search the forums, but did not seem to find anything.
View Replies !
AVG Calculation
how to times my AVG answer by 10, my AVG shows and answer of 5 and i want it to show 50 representing the percentage, Also how would i show this as a percentage not a normal number.
View Replies !
Calculation
I'm creating an order form whereby result is displayed in the next page. <input type="radio" name="gift" value="toy A"/> <input type="radio" name="gift" value="toy B"/> <input type="radio" name="gift" value="toy C"/> They cost $5, $10 and $15 respectively. <input type="checkbox" name="extras[]" value="Ribbon" /> <input type="checkbox" name="extras[]" value="Card" /> <input type="checkbox" name="extras[]" value="Wrapper" /> <input type="checkbox" name="extras[]" value="Box" /> Additional $1 for each of the extras checked. How can I know which toy is chosen, which extras are selected and total up the cost? I just need to display the final total cost.
View Replies !
Sql Calculation
I just started using php and mysql for the past 1 month and slowly picking things up: i got a question on DB calculation. Pls refer the table below: account number ¦ payment ----------------------------- 45621 ¦ $100.00 45621 ¦ $50.00 42000 ¦ $70.00 42000 ¦ $20.00 42000 ¦ $30.00 45656 ¦ $95.00 For the account number, notice that there is duplicate account number with different payment value. Now, how do I calculate the total value for each account ie: for 45621 = $ 150.00 and 42000 = $120.00.
View Replies !
Date Calculation In PHP
Hi! I'm trying to get a date with PHP i.e. 14 days from now in yyyy-mm-dd or any other format like print (date("Y-m-d")) + 14 days. Is there an easy way to do this??
View Replies !
Binary Calculation
I need some way of determining which bits are set in a binary number. eg. Decimal Number: 40 Binary Number: 00101000 How can I determine that the binary equivalent of 8 and 32 are set??
View Replies !
Time Calculation With Php
users of my web site enter time and distance of a run the did into a http-form. the data will be processed by a php-script and stored in an mysql-database. what i want to do is to calculate from the data what time they needed for a 1k-run -> i.e.: if one runs 12k in one hour it will be 5 minutes for 1k. the problem is, the data from the textfield of the form comes in as a string and hence i just can't divide the data ride away. time input should look like: 1:00:00 distance input should look like: 12 and output should look like: 0:05:00 any ideas?
View Replies !
PHP Math Calculation
I am trying to perform a simple calculation from variables passed from a form. The code is as follows: <?php echo "Bonus for the year: <b>"; $x = (($awage * $nibt) + ($awage * $ratio)); $x = number_format($x, 2); print $x; echo "</b><p>"; $xtmp = ($x + $qtr); print $xtmp;?> The calculation multiplies two different values (based on values from the previous page), and then sets it equal to $x. The first calculation prints fine, but when I try to add it to $qtr (also passed via radio button from previous page), it doesn't calculate correctly. I found that if I hard-code the values for $x and $qtr after I print $x, then it will calculate correctly. I am thinking that I am using the variables incorrectly somewhere.
View Replies !
Time Calculation
does anyone know how to calculate time difference between 2 periods of time(say 12:00 am and 1:00am) ?? i have been trying to come up with an algorithm but bugs keep crawling in.
View Replies !
Date Calculation
I would like to make a selection from the database in the following manner ie which is created in the last 1 week or last 2 weeks. There is one field named created_date in the database and the date is in the format yyyy-mm-dd. I have seen date calculations based on month and year but didn't see one on a week basis.
View Replies !
Days Calculation
i can't seem to get this what im trying to do is work out the elapsed time in DAYS from 2 dates code is: $time_now = time(); $d2 = date('Y-m-d H:i:s', $time_now); $d1 = date('Y-m-d H:i:s', strtotime($ng_date)); $days = ceil(($d1 - $d2) / (60 * 60 * 24)); when echoing out it produces: 2007-06-02 16:53:24 2007-08-27 18:00:51 which is right, but $days echoes out as 0.
View Replies !
Add Trailing Zero To Calculation
I am pulling a couple of numbers from a database (productcost and productprice). I am trying to subtract the cost from the price to calculate the profit of the item. I have this part working with no problem. My problem lies when the final number has a trailing zero it will drop that number (i.e. 1.2 as opposed to 1.20) Here is what I am using: $profit = $row_viewcoils['ProductPrice'] - $row_viewcoils['ProductCost']; echo $profit;
View Replies !
Calculation Form
I need to build a calculation form.. basically they click a couple radio buttons from features they want and then the user enter's in the number of words of the document and then they hit "calculate" button and it gives them an estimate for a quote. Need a little help with the structure of the form, anyone shed some light?
View Replies !
Percentage Calculation In Php
i have the following calculation code that adds the $total and the $tax variables.. number_format($total+$tax,2,'.','') how i can calculate the total and then subtract 15% of the final value.
View Replies !
Calculation In A Query?
Is it possible to do something like this: UPDATE `Members` SET `hungerlevel` = (hungerlevel - 1) Im trying to run a query that updates all users in my member table and it takes 1 off their hungerlevel. I could do a while loop i suppose... i was just wondering if there was a way to do it this way.
View Replies !
Database Calculation
for example i rent a space for stock keeping and i can get 1% of total prices per day. I had created a database to record all in/out stock per day as: [date] [status] [quantities] [unit_price] 2007-09-16 'IN' 1000 3.50 2007-09-16 'OUT' 100 3.51 2007-09-17 'IN' 500 3.40 2007-09-18 'IN' 1000 3.35 Sorry for my dumb, i'm stuck on a database calculation above. i hope any expert can show me how to get income calculation between $date1 and $date2 through sql query?
View Replies !
PHP/HTML Calculation
I am making a little Purchase order entry form for a mysql database. I have the form and can submit everything just fine, Only thing is I can't seem to figure out how to make a calculation on various text boxes. I need to make a sum of a group of boxes, calculate taxes etc... Anyone able to point me to some sample code of a way to make arthimatic functions on the contnts of box1 and box 2 and put them in box 3. I will only be inserting box 3 into the database and that part works already.
View Replies !
ORDERING BY My Calculation
Is there any way I can ORDER BY $sum so that the smallest one is shown first, the problem is because the sum comes after the SELECT statement. This is a simplified version to my much larger problem. PHP Code: $maths = "SELECT * FROM maths"; $mathsResults = mysql_query($maths); while ($mathsRow = mysql_fetch_array ($mathsResults)){ $int1 = $mathsRow["int1"]; $int2 = $mathsRow["int2"]; $sum=$int1+$int2; echo $sum; }
View Replies !
Shipping Calculation
I've got to add another condition to my shipping calculation - right now it reads: if ($total > 81.75) {printf ("%01.2f", $total * .11);} else {echo "8.99 ";} The condition I need to add needs to accomodate International shipping - $total * .25. I have a field for '$shipcountry' - the new condition needs to identify whether the order is being shipping with USA or goes to another country... : something like.... IF $shipcountry = "USA", THEN DO USE CODE ABOVE ELSE $total * .25 It looks like a couple of IFs AND then ELSE to me...just wish I knew how to write it.
View Replies !
Array For A Calculation
I am currently using a an array to perform a calculation similar to http://www.webmasterworld.com/forum88/7085.htm. [example] $nearest_distance = array(); $findLocations = mysql_query("SELECT latitude, longitude FROM locations"); while ($loop_findLocations = mysql_fetch_array($findLocations)) { $latitude = $loop_findLocations["latitude"]; $longitude = $loop_findLocations["longitude"]; $yarddistance = distance($latitude, $longitude, $cutomerlat, $cutomerlong, "m"); $nearest_distance[] = $yarddistance; } sort($nearest_distance); print_r($nearest_distance); // print array echo '<br> Best Yard:'. $nearest_distance[0];
View Replies !
Calculation With Month...
I create some search option with drop down list box. search by month is 1 of them. I've a table named orders, suppose LabOrder_No & Log_date. dates are storing in database as yy-mm-dd but im retriving as dd-mm-yy. I will select a month name from list (jan,feb....dec & their values are 01,02...12), click submit button & display the total orders & quantity of that month. to collect total quantity, i wrote a function: Code:
View Replies !
Calculation Of Items
I was just wondering what method is best to use to calculate items from a drop down menu. I have two lots of drop down menu of which i want to send to a page to clarification before being submitted.
View Replies !
Days Ago Calculation?
<?php $month = 10; $day = 17; $year = 2006; $days = (mktime(0, 0, 0, date("m"), date("d"), date("Y")) - mktime(0, 0, 0, $month, $day, $year)) / 86400; echo $days; ?> -> Take the seconds from unixtime now, minus unixtime date, split by seconds in a day = amount of days ago Problem is, the output is: Code:
View Replies !
Calculation Problem
im working out a users age, by deducting the year they were born from this year 2007 so i'm born on 1979, todays year is 2007 2007 - 1979 leaves 28 but the code shows as -28 instead of just 28, i tried a str_replace but no joy ## Year calculation $profileyear = $yearborn - $thisyear; ## Get rid of the - sign str_replace("-"," ", $profileyear); can anyone tell me what i did wrong?
View Replies !
Create A Function To Do The Calculation
writing the following lines of code into a simple function. I'd like to be able to create a function to do the calculation, then feed the $a, $b, or $c variable into it. <?php $a = $kerryvotes/$votes; $kpercentage = $a * 100; $kpercent = round($kpercentage, 0); ?> <?php $b = $bushvotes/$votes; $bpercentage = $b * 100; $bpercent = round($bpercentage, 0); ?> <?php $c = $nadervotes/$votes; $npercentage = $c * 100; $npercent = round($npercentage, 0); ?>
View Replies !
Avg Time On-site Calculation
I am collecting the date and time of each visit to pages on a web-site into a MySQL DB. Would now like to use that info to calculate the avg time a visitor has been on the site. What is the best way to do that?
View Replies !
Date Comparison Calculation
I want build and extract data from a mysql table by date. The problem is that my table data needs to be by date range as follows. Example: key field is DATE field row 1: 02-19-96 to 02-06-97 row 2: 02-07-97 to 01-27-98 row 3: 01-28-98 to 02-15-99 and the input for the query will come from a FORM input (without range), example: Enter birthday input value could be 05-13-96 How can I query the table and select the row with the correct range.
View Replies !
Relative Link Calculation
I am implementing a semi-template system via the use of 'include()' which pull from files from in a dir in the document root. But as the depth of the files in the direcotry structure changes, you can well imagine that relative links get messued up as the include runs the script from the path from which it was called not the path from which it got the file. So basically I'd just like to know if anyone has a smart script to calculate reltative links.
View Replies !
Date Input And Calculation
I need to input the time into a form for a start time and an end time, and write it to the database. I also need to calculate the time to see the time elasped, and input that into a database, for a field of time spent.
View Replies !
OT: Franchisee Area Calculation
I've searched the web for weeks (on and off) but can't find any information about the topic. A client wants to set up a franchisee structure and track this information via a database. I've never done this and uncertain of how I would do it. Initially the client only wants state by state franchisees but I can see that this could eventually be scaled to districts/areas. To compound matters, my client is wanting this to work in any country.
View Replies !
Problem With Date Calculation
im a really noob fresh starting php programmer:P but i need really to solve this problem witha php script: I can rent a flat from 01/01/90 to 01/01/2011 ill rent that flat for a time that i will choice from that timeline above, so ie I could rent that flat from 01/15/93 to 01/15/95. well at this point i need to know how mani days for each year i rent that flat in the above case it would be like this: year 1990= 0 year 1991=0 year 1992=0 year 1993 = 15 year 1994=365 year 1995=15 year 1996=0 year 199... year 2011=0 since im really noob could plz give me: 1)an input about the logic process to use to write a script 2)wich command i should use 3)a whole script or an idea of it if u can i know the days from and to each period, i cant just find the right routine to get the above datas
View Replies !
Simple Date Calculation
I have two dates and I would like to get the difference in minutes: $date1 = date("Y-m-d H:s:i"); // now $date2 = // a date in the same format as above just retrieved from the database it will be in the future So I would like to get just the minutes between them.
View Replies !
Simple Calculation Between Array
i have two arrays : $quantity = array(1,2,3); $price = array(15.45,12.3,23); how do i make those two arrays for a multiply calculation like this : $total = $quantity * $price; i want the total of the calculations in a new array
View Replies !
Street Address Calculation
Does anyone know of a tutorial or script that will calculate driving distance between two street addresses? I have only found ones that does it base on zip codes.
View Replies !
Calculation And Limiting Decimals
I have a greater total of 61 and I score 45 $i= 61; $y= 45; $pct = ($i /$y) * 100; one is tha correct Two how can i limit the number that result diplays (0.987654321 - i just want .987) and how do i turn off this error message??? Warning: Division by zero in localhostinfo.php on line xxx
View Replies !
Bitwise Server Calculation
PHP Code: $x = (4653896912 >> 13); echo $x; I ran that on two different servers. Server A gave me: 43814 Server B gave me: 568102 Any clue why that would happen? Maybe a work around or another way of doing that calculation?
View Replies !
Time / Date Calculation
I'm having trouble getting this code to work. can someone please take a look and tell me what I'm doing wrong? I'm trying to calculate time in minutes/days of the 2 dates. <?php $dateFormat = "m/d/Y H:i:s"; $targetDate = "4/13/2007 05:14:01"; $actualDate = "4/13/2007 04:14:01"; $secondsDiff = $targetDate - $actualDate; $remainingDay = floor($secondsDiff/60/60/24); $remainingHour = floor(($secondsDiff-($remainingDay*60*60*24))/60/60); $remainingMinutes = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))/60); $remainingSeconds = floor(($secondsDiff-($remainingDay*60*60*24)-($remainingHour*60*60))-($remainingMinutes*60));............
View Replies !
Elapsed Time Calculation
I am developing a basic ticketing system to log customers calls on etc. I have a MySQL table that stores the time the ticket was created/logged in a MySQL timestamp IE NOW() which gives the value of something like this: 2005-08-26 19:45:11 I am wanting to figure out how long it has been since this ticket was generated (Age of ticket) since the date it was created, can anyone help me out ? I have trawled the web for a solution but as yet have come up with very little.
View Replies !
|