...

View Full Version : $months[$row['month']] ???



jcma
01-27-2003, 11:28 AM
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

Jeewhizz
01-27-2003, 11:29 AM
are you retrieving a value of '01' or jusr '1'?

jcma
01-27-2003, 11:38 AM
01

but when i try $months[01] it works fine

Íkii
01-27-2003, 01:11 PM
try

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

and after reading the end of your question...

perhaps deassociate your array

$months = array("", "Jan", "Feb", ...);

jcma
01-27-2003, 01:25 PM
none worked :(

jcma
01-27-2003, 01:31 PM
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
01-27-2003, 01:33 PM
it works :thumbsup:

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

thanks for the tips / help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum