Monday, 26 September 2011 15:33
This article is a quick note (so I never spend as long again) in PHP on how to determine when looping through a loop, which entry was first and which was last. This is incredibly useful for pagination.
Tuesday, 31 January 2012 09:24
$total_time =intval(intval($total_seconds)/ 3600).":"; $total_time.=str_pad(intval(($total_seconds/60)%60),2,"0",STR_PAD_LEFT).":"; $total_time.=str_pad(intval($total_seconds%60),2,"0",STR_PAD_LEFT); // yields // 82800 = 23:00:00 // 108000 = 30:00:00On one line:
$total_time=intval(intval($total_seconds)/ 3600).":".str_pad(intval(($total_seconds/60)%60),2,"0",STR_PAD_LEFT).":".str_pad(intval($total_seconds%60),2,"0",STR_PAD_LEFT);
Monday, 26 September 2011 15:33
Wednesday, 06 April 2011 13:50
Date Customer Time From Time To Hours ---------- --------------- --------------- ---------------- -------------- 04/03/2011 Tweedle Dee 10:00 12:00 2.00 08/03/2011 Tweedle Dum 23:30 00:30 -23.00Note the last row is obviously incorrect. This is because the script is not changing the date at the stroke of midnight. Take the last row as an example, the equation that's happening is:
$thisDateSQL=date("Y-m-d", strtotime($sub_row['DateSession']));
$this_time_from1 = date("H:i", strtotime($sub_row['TimeFromSession']));
$this_time_to1 = date("H:i", strtotime($sub_row['TimeToSession']));
$this_time_from_sql=$thisDateSQL." ".$this_time_from1.":00";
$this_time_to_sql=$thisDateSQL." ".$this_time_to1.":00";
$sum_hours = number_format(((strtotime($this_time_from_sql)-strtotime($this_time_from_sql))/60)/60, 2);
// Using the examples above this is doing the following:
2011-03-04 12:00:00 - 2011-03-04 10:00:00 = 2.00
2011-03-08 00:30:00 - 2011-03-08 23:30:00 = -23.00
This is great for everything during that date as long as the "To Date" never goes past midnight into the next day... But what system doesn't do this (no Microsoft jokes please)?
Wednesday, 09 March 2011 15:14
$search_term_esc = AddSlashes($search_term); $sql = "SELECT * FROM Content WHERE content_body LIKE '%$search_term_esc%'";Great! Few problems though, multiple terms are not supported; quotation marks and apostrophes may be an issue;
Thursday, 30 September 2010 08:55
$today=date("Y-m-d");
$yesterday = date('Y-m-d', mktime(0, 0, 0, date("m") , date("d") - 1, date("Y")));
Page 1 of 3
A huge WELCOME goes to today's newest members:
| Member Signups (Activated) | ||||
| Before | Current | Trend | ||
| Day | 2 | 4 | é | |
| Week | 32 | 16 | = | |
| Month | 201 | 106 | ê | |
| Year | 2,265 | 307 | ê | |
Member Stats | ||||
| 87 guests are currently online. | ||||
| 1,101 members are still deciding. | ||||
| There are 5,553 members in total. | ||||