Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2003, 11:28 AM   PM User | #1
jcma
New Coder

 
Join Date: Jan 2003
Location: Lisbon / Portugal
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
jcma is an unknown quantity at this point
$months[$row['month']] ???

i have an array
$months = array(1=>"Jan","Fev",.......)

and i retreive the month number through a query.

and when i try :
$months[$row['month']] it doesn't return anything.

$row['month'] -> 01, 02 ,03, ...

$months[01] works fine...

but both thing doesn't work.

i've tried
$db_month = $row['month'];
$months[$db_month]
but it doesn't work too...

can some one help me... thanks
jcma is offline   Reply With Quote
Old 01-27-2003, 11:29 AM   PM User | #2
Jeewhizz
Regular Coder


 
Join Date: May 2002
Location: London, England
Posts: 369
Thanks: 0
Thanked 0 Times in 0 Posts
Jeewhizz is an unknown quantity at this point
are you retrieving a value of '01' or jusr '1'?
__________________
Jeewhizz - MySQL Moderator
http://www.sitehq.co.uk
PHP and MySQL Hosting
Jeewhizz is offline   Reply With Quote
Old 01-27-2003, 11:38 AM   PM User | #3
jcma
New Coder

 
Join Date: Jan 2003
Location: Lisbon / Portugal
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
jcma is an unknown quantity at this point
01

but when i try $months[01] it works fine
jcma is offline   Reply With Quote
Old 01-27-2003, 01:11 PM   PM User | #4
Ökii
Regular Coder

 
Join Date: Jun 2002
Location: UK
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Ökii is an unknown quantity at this point
try

$months[ ( $row['month'] ) ]

and after reading the end of your question...

perhaps deassociate your array

$months = array("", "Jan", "Feb", ...);
__________________
Ökii - formerly pootergeist
teckis - take your time and it'll save you time.

Last edited by Ökii; 01-27-2003 at 01:14 PM..
Ökii is offline   Reply With Quote
Old 01-27-2003, 01:25 PM   PM User | #5
jcma
New Coder

 
Join Date: Jan 2003
Location: Lisbon / Portugal
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
jcma is an unknown quantity at this point
none worked
jcma is offline   Reply With Quote
Old 01-27-2003, 01:31 PM   PM User | #6
jcma
New Coder

 
Join Date: Jan 2003
Location: Lisbon / Portugal
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
jcma is an unknown quantity at this point
i think i found why.

$array [$a] allows $a to be (in my case):

$a = 1;
$a = 01;
$a = "1";

doesn't accept $a= "01";
jcma is offline   Reply With Quote
Old 01-27-2003, 01:33 PM   PM User | #7
jcma
New Coder

 
Join Date: Jan 2003
Location: Lisbon / Portugal
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
jcma is an unknown quantity at this point
it works

i just changed mysql date_format from %m to %c and it's ok now

thanks for the tips / help
jcma is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:39 AM.


Advertisement
Log in to turn off these ads.