Discussion » Php Query

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by earthworm, 12:14, 24th October 2003:
 
I just want to ask a quick question:

Is it possible to work with excel files in PHP? I was wanting to input the path of an excel spreadsheet and find out different things like how many people are under 19 etc. I was thinking about excel because a program that my wife is using, can output data into a spreadsheet. I realise this would be much easier in a database. Would it be easy to use a spreadsheet as a kind of table?
Posted by Grim..., 12:21, 24th October 2003:
 
PHP can work with Access - I don't know about Excel - I've never heard of it...
Posted by earthworm, 12:26, 24th October 2003:
 
never heard of excel?

(lol)
Posted by Sul, 12:27, 24th October 2003:
 
It's a Microsoft spreadsheet application, part of the MSOffice suite.
Posted by Sul, 12:27, 24th October 2003:
 
bah too slow to type ;)
Posted by earthworm, 12:29, 24th October 2003:
 
haha... sorry sul...
Posted by earthworm, 13:04, 24th October 2003:
 
[quote] testing [/quote]
Posted by earthworm, 13:05, 24th October 2003:
 
how do you do quotes here??
Posted by arsepuppy, 13:20, 24th October 2003:
 
div class="quote" with those HTML brackety things.
Posted by Grim..., 13:41, 24th October 2003:
 
<div class="quote">What you want to quote goes here</div>
Posted by Foghorn Leghorn, 13:42, 24th October 2003:
 
What you want to quote goes here
Posted by Foghorn Leghorn, 13:42, 24th October 2003:
 
da na
Posted by friday, 15:17, 24th October 2003:
 
What you want to quote goes here. Cool, I was wondering how to do that!
Posted by cal, 17:33, 24th October 2003:
 
unfortunately, the excel file format was designed by crack-addled monkies. you could have a stab at reversing this xls generating code to do what you want: pear.php.net/package/Spreadsheet_Excel_W...

a much more sensible idea is exporting csv from excel and importing that via php. there are a ton of good csv php classes, although bizarrely not one in PEAR.
Posted by tommorris, 02:02, 25th October 2003:
 
I agree with Cal. Excel is stupid. CSV is what you need.

Oh, and PHP is the best thing since sliced bread.
Posted by Grim..., 09:18, 27th October 2003:
 
What was the best thing before sliced bread?
Posted by Sul, 09:30, 27th October 2003:
 
bread knives
Posted by earthworm, 20:10, 27th October 2003:
 
ARGHH!!

OK then... here's another one...

I have a form I am creating. It is a form to book AV equipment at the college. I said I would have a stab at creating it online (cause paperwork is shit...)

Joe Bloggs wants a projector and a laptop setting up in D24 on the 12/11/03. According to college policy, he has to fill in the form and hand it to us 48+ hours before the equipment is being used. I know how to get todays date, but how do I get PHP to work out the date in two days time? Then I will subtract the two dates and introduce a warning if two+ days (48+ hours) is not present...

I have checked on PHP.net and the closest thing I can find is that PHP lacks what ASP has... (according to a user there)

I am sorry for asking so many questions... I'm sure you have better things to do...

many thanks for any pointers you can give me...
Posted by cal, 21:16, 27th October 2003:
 
$today = date();

$2_days_time = date() + 2 * 24 * 60 * 60;


unix time is just in seconds, so it's easy to do stuff like add hours to it. if you want a "clean date", as in, today, at 00:00, then do this:

$today = mktime(0,0,0,date('m'),date('d'),date('Y'));


which you can then add (2 * 24 * 60 * 60) to to get midnight in two days time.