Calculate Future Months [Reference Correction]
that ref fails for me after being googlegroupbeta'd... hopefully,
try this: http://groups.google.com/groups?th=613f743e0cf622f3
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Calculate Years And Months Of Service
I have each employees hire date stored in date format in MySQL (YYYY-MM-DD) and would like to calculate how many years and months of service they have. The output would be like: Years of Service: 7 yr and 2 mo How would I go about doing this calculation?
Include And Sub-includes (correction)
I did a typing error in my last post. Fixed. ----------- We are currently changing our web server and, in the process, updating PHP version from 4.3.0 to 4.3.5. The problem we've got is that our way to include some files in other ones is no more working properly. The message we are getting looks like: "PHP Warning: main(..db.inc.php): failed to open stream: No such file or directory in ..." Say we have this file structure: myApplication (dir) index.php include (dir) db.inc.php authentification (dir) user.inc.php login.php - user.inc.php includes db.inc.php calling "include('..db.inc.php')" - both login.php and index.php includes user.inc.php - index.php calls "include('includeauthentificationuser.inc.php')" - login.php calls "include('user.inc.php')" <-- Corrected here I know I could solve this problem by making those the includes absolute instead of relative but I would prefer to let it relative for some developement reason. myApplication actually contains many other files calling "include('..db.inc.php')" so I don't want to move this file. Our old configuration seems to include child-includes in their parents before including the parent-include in the main file. Now it seems to include parent before include childs.
Error Correction On Drop Down List & Sessions
Hi I'm doing a site at the mo and I have to do error correction on a form. I have most of it done except one or two bits. What I'm having trouble with is drop down lists. What happens is someone fills in the form, it's not done properly so it gets redirected back to the form. Everything works right except the drop down list. The sessions carries over alright but I can't get the drop down list session to work. It marks the session as selected but it's not displayed the first option is displayed. So if you picked Germany and America was first on the list. After being submited America would be displayed but Germany would be checked. Here is what I got Correction page $_SESSION["country"] = $_POST["country"]; if($_SESSION["country"] == Ɔ'){ header("Location: /acc1.php"); } Form page echo ' <td><select name="country" id="country" style="width: 150px;">' if (!isset($_SESSION["courtry"])){ echo '<option value="0" checked="checked"></option>' } $rslt = mysql_query($dscntry); if($rslt){ while ($rws = mysql_fetch_array($rslt)) { if (!isset($_SESSION["country"])){ echo '<option value="'.$rws["countryid"].'">'.$rws["countries"].'</option>' } elseif(isset($_SESSION["country"])){ if($_SESSION["country"] == $rws["countryid"]){ echo '<option value="'.$rws["countryid"].'" checked="checked">'.$rws["countries"].'</option>' // else{ // echo '<option value="'.$rws["countryid"].'">'.$rws["countries"].'</option>' // } } } } } echo '</select>'
Reference Stays Reference Even If Passed By Value
I started porting a huge PHP application to PHP5 and encountered a problem with references. I don't know whether the behavior I see is a bug or a feature. The following nonsens test program should make clear what's the problem: class test { public $_foo = null; public function __construct($foo) { $this->_foo = $foo; } } function fct1(&$p) { print "before call to fct2(): $p->_foo "; fct2($p); print "after call to fct2(): $p->_foo "; } function fct2($p) { print "in fct2(): $p->_foo "; $p->_foo = "bla bla bla"; print "after modifying value parameter fct2(): $p->_foo "; } $t = new test("Hello World!"); fct1($t); If I evaluate this code with php v5.1.2 I get the following output: before call to fct2(): Hello World! in fct2(): Hello World! after modifying value parameter fct2(): bla bla bla after call to fct2(): bla bla bla I don't understand this: fct1() takes a parameter as reference, so fct1() should be able to change the argument I pass to it, but it does not do this. Instead it call fct2(), a function that takes a "value parameter". In my understanding, fct2() can change its argument, but changes to not affect the caller, ie. changing the parameter should not affect the variable passed to it in the callers scope. Am I wrong or is this a (known) bug? BTW: The PHP4 version works fine with php4.
Get "Months Between" Using Only Months And Years
I'm planning a form that takes Work History detail. Of course two of fields in this form are "From" and "To". For this project, the client doesn't need to know the "From" Day, or the "To" Day. He just wants to capture from "2003-07" to "2006-09" for example. My problem is, without using the entire date string "2003-07-07 / 2006-09-01" how does one go about accurately determining the number of months between the two year/month pairs? Is this possible, or do I have to capture the full date?
Date() In The Future?
This is returning a date 1 hour in the future? $SBText .= date("F j, Y, g:i a"); How would I fix this?
Php4 The Future
I am studing perl at the moment for fun and will be done in a month or two but i want to now is PHP4 easy if you now perl???? I want to leard something new, the best in web development where should i go?
Finding Out A Future Date
I've creating a script that displays an advert on my site for 90 days. I've got the current date in the following format: $todaysDate = date(mdy); I need to know how to find out the date in 90 days time, keeping it in the same format.
Postgresql Or Mysql Future
why mysql is more diffused than postgresql? Postgresql licence is really free more than mysql, but why postgresql is not much diffusing? the future will be of mysql?
Using PHP5 OO Features...and Any .net In Future?
I've been using PHP for a few years now, have used ASP in the past, and PHP (IMO) is far superior! However, last year I had the opportunity to do some work in ASP.Net...and wow! Really liking what .Net can do. Anyway, I've seen a lot of teasing statements about new OO features in PHP5, but I can't really find any comprehensive site detailing these new OO features, what they are, what they do, how to use them. Any suggestions? I did a Google, and darn it if I didn't find anything of use. My other question, and perhaps it's more of a Linux/Apache question, but is there any chance of being able to use C#.Net on a Linux server any time soon? I really REALLY don't want to have to use an IIS server, but I'm really liking what I see in C#.Net.
Calculating Future Dates
I have a variable ($today) that is simply $today = date("m/j/Y"); I want to get another variable for x months down the line, but using the php.net reference of the mktime and date command, my second date, as follows comes out in a large number. How can I make sure it is forwarding the date properly, and format it like mm/dd/yyyy? This is the line from php.net reference page. I need this to calculate properly, and format mm/dd/yyyy - just like my variable up top. $two_months_from_today = mktime(0,0,0,date("m")+2 ,date("d"),date("Y"));
Getting A Date 2-years In The Future...
How do I amend this statement to make it so that the variable $newDate is 2-years later than today's current date?: <?php $newDate = date('Y-m-d'); ?> I tried: $newDate = (date('Y-m-d') + 730); But that didn't work.
Calculating Days From NOW From Future Datestamps
Hi All,I have datestamps of the format 11202006 (November 20th 2006) in the DB. All these datestamps are of the future. With reference to the datestamp, I need to query the database for all entries that are 90, 60, 29, 28, 27, 26, ... 02, 01 days away from NOW. So, if there are entries with datestamps 90 days from NOW, they will need to be displayed.The query will be run everyday through a CRON script. How do I create the queries? Would there be multiple SELECT queries? Eg: 90, 60, 29 .. 02, 01
How About Const Supporting Array In Future?
Array is the very basic type in php i think. So why const keyword doesn't support such defination grammar? class Date { const char3 = array(1 ='Jan', ...); // ? } So how can i do somthing like c++'s enum? class Data { const Jan = 1; //... }
Storing Data For Future Visits
I have this problem: I have a database with information about games, and users are able to vote for them. Everytime a user votes for a game I store the unique game name into a session variable (an array). So if they are in a page were they already voted, they won't have the option to do so. The idea is that the session cookie lasts "forever", I don't want them voting for the same game everytime they get to the site. This isn't soo strict, I don't care if some few users don't accept cookies and eventually vote 2 times for the same game. So what I did is to have a session cookie with a very large expire time and I noted that the session variable data is stored in my server in /temp/sess_blabla my questions are: 1. how much does this data last?, can I make it last forever with session_cache_expire()? I still don't like this solution, data would be lost if I change the server, I would prefer that the client store this info with his session ID so: 2. I've searched and read that you can store data in a cookie, but coudln't find the way to do it. Can I store this variable in the users session cookie?, how?
Send Email On Future Time
Is there a way to send an email on future time? any helpful links or useful tutorials you can give will be appreciated.
What About Future Of RUBY In Coming Days In It Field
future of RUBY now am working in php my sql platform but now i got a new job in RUBY on rail platform i am not have an idea in RUBY , so i want to know about RUBY , can i shift into this technology. what is the future of the ruby, now am in chennai .
Print Last 6 Months
I know you can get the current month using data("m"); How can I output the last 6 months (numeric value "m" and text representation "M") from the current month including the current month. Have tried a few solutions but falling down when current month is for example 2 it should print out: 2- Feb 1 - Jan 12 - Dec 11 - Nov 10 - Oct 9 - Sept
PHP Numbers To Months?
I'm creating a calendar type thing. The variable $month will be a value ranging from 1-12. I need somehow to translate 1, the first month, in january - 2 into february - 3 into march etc. It auto increases so i cant just change the value to jan, feb. $month has to server two purposes and i dont know how to get it to turn "1" into "january".
Months Dropdown
I'm looking to do a dropdown with the months in the year starting with this month and going on for 12 months, ie. the selected month is April 2007 and the last month is March 2008, does anyone know how to do this using PHP?
Last 3 Months Dropdown
I need to come up with something that will take the current month, for example this month is april. It would create a drop down list like Feb 1 - feb 30 march 1 - march 30 April 1 - April 30 Basically the last 3 months, including this one. Then I am going to need to save the month as the value, so I can pass it to the script so I know what date ranges I am looking for. I can't think of a logical way to do this, and still account for the fact that some months have 29 days, some have 30, and some have 31.
Months Diference Between Timestamps
How can I get the enlapsed months, complete months between two timestamps (Unix timestamps)? is there any function that'll help me ? or what aproach should I use?
MYSQL - Select XX Months
I have a database set up, with one of the fields is a month - "200611" = November 2006 "200610" = October 2006 "200609" = September 2006 I was wondering, I know how to sort descending etc.. - Is there a way, to (add to an existing search criteria).. select all records in the last XX months.. IE, If I only wanted the last 2 months, it will only select records in October & November 2006.... or September also - if I want 3 months... (I have records going back to April 2006) Im guessing the 'unique' function will be used, but im not sure how to select XX months.....
Display 11 Consecutive Months
I need to display 11 consecutive months from any given month so something like $current_ month + 11 would give me Nov 2002-Oct 2003. Code:
Number Of Months Between 2 Dates?
i have my dates in timestamp in mysql, please provide code to get the number of months between these 2 days, i've already been searching on the internet for hours.
Storing Months In Mysql 4
I'm using PHP 4 and MySQL 4. I want to store the month and year as a single row but I am having difficulty figuring out the best data type to use. I suppose I could use 'DATE' and then always have the day value be equal fto 1, but I figure there's a more elegant approach. I leave it to on e of you experts to recommend one.
Drop Down List With Months
I am trying to create a drop down list that has December 2006 as the first option and then goes up month and years till the current month and year (September 2007).
Days Based On Months
I am trying to modify some code so that the days dropdown has the correct amount of days for each month( Jan - 31 days, Feb 28, etc). I managed to get it so the correct days appear however it lists all the days. Code:
List All Months Since YYYY-MM-DD
How can I print in a list format, all the dates since 2006-12-01 up to today, for for example December 2006 Janurary 2007 February 2007 March 2007 April 2007 and then as we get into a new month, it would be added onto the bottom. I'm sure ive asked this before but I cant seem to find the post or example I saved.
Finding Months With Data
I have a simple 'blog' database table containing content with the posted date entered as date (yyyy-mm-dd). Some months there will be many items, some months there may be none. Can I generate a list of months where there is at least one item, without lots of separate queries? If so, how?
Drop Down List Of Months
I am trying to create a drop down list with 12 months as the contents. I need to be able to determine what the latest month is and then put the 11 months before into it (in the correct order). For example, it is September 2007 obviously at the moment, so that will need to be the last and latest month in the list. The other 11 will be in reverse order going back to August 2006.
How To Populate Selects With Years=>months=>days That Dynamically Change?
What I'm thinking of doing is in my admin page have three different selects. They will form the day of sales at my shop. -YEAR- -MONTH- -DAY- The years will have 2002 -> 2005 and the months will be the 12 months of the year of course but I need the number of days to change with the particular month selected.
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;
Calculate Rank
I need to display the rank of my players. The rank is based on this row: c_strength What would I use to count their rank, ie: Rank: 54 of 5,231
Calculate Total Of A Column
I have a column in mysql called price, and I would like to total the toal value of all items in that column, how do I do that?
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,
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:
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
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.
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.
How To Calculate Date Difference?
Any one can suggest me how to calculate the difference between 2 dates and it shouldn't be more then 5 years. So pls tell me how to code this?
Calculate A Date Diff
Does anybody know of a script where I can calcullate a datediff and make a pop-up apear a week before a certain date.
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:
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:
|