Re: Strip numerical indices from array
| From: | Larry Garfield | Date: | Mon, 13 Aug 2007 03:35:56 +0000 |
| Subject: | Re: Strip numerical indices from array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260752@lists.php.net to get a copy of this message | ||
There is, but you want to be using mysql_fetch_assoc() instead which gives you
just the keyed indexes in the first place.
Or, better yet, use mysqli_ or PDO which offer better security than mysql_ if
you're running PHP 5 (which you are, right? <g>)
On Sunday 12 August 2007, Dave M G wrote:
> PHP General list,
>
> I've got an associative array that also includes a numerical index. The
> numerical index was automatically generated from the mysql_fetch_array
> command, so it the values are the duplicates of the associative key names.
>
> Is there a way to simply strip off the numerical index, leaving only the
> associative key names?
>
> --
> Dave M G
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson