Re: printing values from a 2 dimension array

From: Date: Wed, 15 Oct 2003 13:02:33 +0000
Subject: Re: printing values from a 2 dimension array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-166203@lists.php.net to get a copy of this message
here you go: <? $code[0]=array(12,14,16,19,21,23,25,28,29,30); reset ($code[0]); $rslt =array(); while (list($key, $value) = each ($code[0])) { $name =$code[1][$key]; $query="select count(index) from campaign where (datebooked between '$today' and '$tomorrow') and (resultcode = '$value') and (source !='Outbound')"; $result=mssql_query($query,$numero); $row=mssql_fetch_row($result); $rslt[0][$key]=$row[0]; } print $rslt[0][1]; ?> Cheers Bob Jason Wong <php-general@gremlins.biz> wrote: On Wednesday 15 October 2003 17:44, bob pilly wrote: > Im having problems printing values from a 2 dimensional array: > If i have: > temp[0]=array(0,10,11); > temp[1]=array(a,b,c); > print $temp[0][1]; > > i expected the output to be '10' instead i get 'Array[1]', however if i > use: > > $var=$temp[0][1];print $var; i get '10' as the output. This is fine but it > defeats the purpose of what i am trying to do, can anyone tell me why this > is happening? Im new to arrays and its fairly confusing. Thanks for any > help in advance! Try posting your *real* code. The above should not even run. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Chairman of the Bored. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --------------------------------- Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

« previous php.general (#166203) next »