Jump to content

show full array funtion i am working on


M.O.S. Studios

Recommended Posts

hey,

I made this simple function

function mysql_fullarray($resource)
{
while($array=mysql_fetch_array($resource))
{
	$return_array[]=$array;
}
return $return_array;
}

 

it returns each value twice, one time with the key, one time with a number instread of the key,

like the following

 

    [0] => Array
        (
            [0] => 44
            [index] => 44
            [1] => test
            [name] => test
            [2] => 1
            [internal] => 1
            [3] => test.php
            [inlink] => test.php
            [4] => 
            [exlink] => 
            [5] => 0
            [header] => 0
            [6] => 100
            [sort] => 100
            [7] => 1
            [act] => 1
        )

i was thinking i could stop it using is_numeric, but that will get rid of keys that have a numeric name,

 

any ideas??? thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/164169-show-full-array-funtion-i-am-working-on/
Share on other sites

The following is from the PHP.NET reference:

 

By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works). 

 

For more information on this, see http://us.php.net/mysql_fetch_array

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.