FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to construct an associative and numeric indexable array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How to construct an associative and numeric indexable array [message #178277 is a reply to message #178276] Sat, 26 May 2012 04:27 Go to previous messageGo to previous message
Leonardo Azpurua is currently offline  Leonardo Azpurua
Messages: 46
Registered: December 2010
Karma:
Member
"Jerry Stuckle" <jstucklex(at)attglobal(dot)net> escribió en el mensaje
news:jppkou$jug$1(at)dont-email(dot)me...
>
> OK, you're using the newer functions. Still, RTFM.
>
> http://us3.php.net/manual/en/function.sqlsrv-fetch-array.php
>
> It explains things quite clearly. But if you don't know PHP, then you
> need a lot more help than this page.

Hi, Jerry:

Ok... forget SQLSRV. It was just the source (not the object) of my question.

Let's say I have an array $arr, constructed thus:

$arr = array("one" => "X", "two"=>"Y", ..., "umpt" =>"ZZZZZ");

so that I can get $arr["one"] or $arr["umpt"].

Now, at some moment, I want to obtain the (n+1)th value in the array. I just
can't write $arr[$n];

I know I might write:
$k = array_keys($arr);
$x = $arr[$k[$n]];

But when you use the array returned by sqlsrv_fetch_array, you can either
write $arr["C1"] or $arr[0].

Do you know how they do that?

Thanks!

--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Overriding PHP INI Setting session.use_trans_sid=0
Next Topic: Saving a three-dimensional array to the mysql database.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 13:40:24 GMT 2024

Total time taken to generate the page: 0.03605 seconds