Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

RE: [PHP-DB] Re: Just can't get it to work.. variables
Yeah, I ended up doing that (associative array) then reading your
e-mail.. Oh well, thanks.
I couldn't cast the var as an int. in the database it's setup as a
timestamp(8) (yyyymmdd), not sure why I set it up as such..

Cheers,
Gavin

-----Original Message-----
From: Martin Norland [mailto:martin.norland@stjude.org]=20
Sent: Thursday, March 31, 2005 12:43 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Re: Just can't get it to work.. variables


David Robley wrote:
> Gavin Amm wrote:
[snip]
> That would indicate that you are actually saying:
>  $monthVal =3D $monthName[04];
>=20
> where the 04 is actually a string; you have no element '04' in your=20
> array. Cast $monthInt to an integer before you use it as an array=20
> element.
>=20
> Alternatively, if you are using MySQL, you can use DATE_FORMAT to=20
> achieve the same result.
>=20 

Yep, also - no need to redeclare $monthName each iteration.  If you=20
wanted you could also just declare it thusly:

$monthName =3D array ("01" =3D> "Jan", "02" =3D> "Feb", "03" =3D> "Mar", =
"04" =3D>

"Apr", "05" =3D> "May", "06" =3D> "Jun", "07" =3D> "Jul", "08" =3D> =
"Aug", "09"=20
=3D> "Sep", "10" =3D> "Oct", "11" =3D> "Nov", "12" =3D> "Dec");

... incidentally, Oct/Nov/Dec should have worked previously afaik, PHP=20
is fairly forgiving.  You can probably also get away with just using=20
round() to get your integers where you need them, instead of the=20
declaration above.

cheers,
--=20
- Martin Norland, Sys Admin / Database / Web Developer, International=20
Outreach x3257
The opinion(s) contained within this email do not necessarily represent=20
those of St. Jude Children's Research Hospital.

--=20
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this thread to moderator Post Follow-up to this message
Old Post
Gavin Amm
03-31-05 08:57 AM


RE: [PHP-DB] Re: Just can't get it to work.. variables
Gavin Amm wrote:

> Yeah, I ended up doing that (associative array) then reading your
> e-mail.. Oh well, thanks.
> I couldn't cast the var as an int. in the database it's setup as a
> timestamp(8) (yyyymmdd), not sure why I set it up as such..
>
> Cheers,
> Gavin

I guess I didn't fully explain that I meant cast as an int in php :-)

David

Report this thread to moderator Post Follow-up to this message
Old Post
David Robley
03-31-05 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:04 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.