[PHP] odd while behavior...

2010-10-16 Thread Jason Pruim
Okay so I'm just playing around with some stuff trying to learn more and expand my knowledge and I ran into something I don't understand... Take the following code: "; $i ="0"; while($i <="12") { $dateformat = date("M", mktime(0,0,0, $i,0,0)); $month = mktime(0,0,0, $i,0,0);

Re: [PHP] odd while behavior...

2010-10-16 Thread Simon J Welsh
This is because of your mktime() call. You're trying to get the zeroth day of the month, which is the last day of the preceding month. Using mktime(0, 0, 0, $i, 1) instead should give you the desired results, assuming you do start at 1, and not 0 as you have in your code. --- Simon Welsh On 17/

Re: [PHP] odd while behavior...

2010-10-16 Thread Alexander Schrijver
On Sat, Oct 16, 2010 at 11:12:03AM -0400, Jason Pruim wrote: > Okay so I'm just playing around with some stuff trying to learn more > and expand my knowledge and I ran into something I don't > understand... Take the following code: > > > echo ""; > $i ="0"; > while($i <="12") { > > $dat

Re: [PHP] odd while behavior...

2010-10-16 Thread a...@ashleysheridan.co.uk
I wouldn't really use a while statement for this, but a for loop instead, as it needs less code: "; for($i =1;$i<=12;$i++) {     $dateformat = date("M", mktime(0,0,0, $i,0,0));     echo <<$dateformat $i HTML; } echo ""; ?> The other code was starting from 0 and going to 12, which is 13 mo

Re: [PHP] Error message not understood

2010-10-16 Thread sueandant
I've run both programs. [1] outputs Client library version 5.1.51, but [2] gives no output. However I have checked MySql status via the command prompt which tells me mysql Ver 14.14 Distrib 5.1.51 for Win32(ia32). I originally installed PHP 5.3 but I couldn't get it to communicate with mysql

RE: [PHP] Error message not understood

2010-10-16 Thread Tommy Pham
> -Original Message- > From: sueandant [mailto:hollandsath...@tiscali.co.uk] > Sent: Saturday, October 16, 2010 1:16 PM > To: Luigi Pressello > Cc: PHP > Subject: Re: [PHP] Error message not understood > > I've run both programs. [1] outputs Client library version 5.1.51, but [2] > gives n

Re: [PHP] Error message not understood

2010-10-16 Thread sueandant
Apologies! Vista Home Premium 32bit with SP2. I uninstalled it using Windows' uninstaller. I didn't compile any of the packages. MySQL was installed using the .msi download and PHP I simply unzipped to my C:\PHP folder. And, yes, they both came from the official sites. - Original

RE: [PHP] Error message not understood

2010-10-16 Thread Tommy Pham
> -Original Message- > From: sueandant [mailto:hollandsath...@tiscali.co.uk] > Sent: Saturday, October 16, 2010 2:23 PM > To: Tommy Pham > Cc: PHP > Subject: Re: [PHP] Error message not understood > > Apologies! Vista Home Premium 32bit with SP2. I uninstalled it using > Windows' unins

[PHP] Binary data unpacking

2010-10-16 Thread Justin Martin
Hello everyone, For the past while, I've been working on a class for reading in, modifying and writing out NBT-format files. This particular format is used for the game Minecraft, as some of you may know. Attached is my work so far on this, which is coming close to being a working solution t

[PHP] Addendum: Binary data unpacking

2010-10-16 Thread Justin Martin
Sorry, I had forgotten that attachments weren't accepted on the list. My code can be found at http://pastebin.com/6nmR67c3. The test NBT can be found via the NBT specification link. Thanks, Justin Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.ne

[PHP] Questions from a Newbie

2010-10-16 Thread Ethan Rosenberg
Dear List - Here are some questions, which I am sure are trivial, but I am a newbie, and cannot find the answers online I cannot get the following to work. In my Firefox [Iceweasel] browser, I enter the following URL: [w/ the http] localhost/CreateNew.php All I get is a blank browser

RE: [PHP] Questions from a Newbie

2010-10-16 Thread Tommy Pham
> -Original Message- > From: Ethan Rosenberg [mailto:eth...@earthlink.net] > Sent: Saturday, October 16, 2010 10:01 PM > To: php-general@lists.php.net > Subject: [PHP] Questions from a Newbie > > Dear List - > > Here are some questions, which I am sure are trivial, but I am a newbie, and

[PHP] strtotime

2010-10-16 Thread John Taylor-Johnston
$now=date("Y-m-d"); A = $mydata->birthday = 1928-02-12; B = $mydata->birthday = 1965-03-18; C = $mydata->birthday = 1976-04-11; I'm doing a demographic sort. How do I calculate whether $mydata->Birthday falls into these categories below? I'm working my way right now through the manual: http:/

[PHP] Re: strtotime

2010-10-16 Thread John Taylor-Johnston
According to this, I'm 44 not 45 :)p $birthday = '1965-08-30'; //calculate years of age (input string: -MM-DD) function birthday ($birthday){ list($year,$month,$day) = explode("-",$birthday); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff =