split a huge array into fixed number of values arrays
Posted: Fri Jul 21, 2006 6:36 pm
I have this function
When i do a print_r on the mysql_fetch_all($select) where $select is the result from a select query i get
Is there a way that i can simply split up this array into smaller arrays that i can use, no matter the size of the DB ?....
I mean something like $result1, $result2 or something and auto-incrementing.... I would then use that to display just That row.
Would implode() do the job?
Code: Select all
function mysql_fetch_all($result) {
$i = 0;
for ($i=0; $i<mysql_num_rows($result); $i++) {
$return[$i] = mysql_fetch_array($result);
}
return $return;
}Code: Select all
Array ( [0] => Array ( [0] => 1 [Index] => 1 [1] => aa [Name] => aa [2] => bb [Description] => bb [3] => cc [Path] => cc [4] => 0 [Executed] => 0 [5] => 0 [Sold] => 0 [6] => 0 [Price] => 0 ) [1] => Array ( [0] => 2 [Index] => 2 [1] => ba [Name] => ba [2] => ab [Description] => ab [3] => c [Path] => c [4] => 1 [Executed] => 1 [5] => 2 [Sold] => 2 [6] => 3 [Price] => 3 ) [2] => Array ( [0] => 3 [Index] => 3 [1] => a [Name] => a [2] => b [Description] => b [3] => c [Path] => c [4] => 0 [Executed] => 0 [5] => 0 [Sold] => 0 [6] => 0 [Price] => 0 ) [3] => Array ( [0] => 4 [Index] => 4 [1] => ab [Name] => ab [2] => cb [Description] => cb [3] => db [Path] => db [4] => 12 [Executed] => 12 [5] => 32 [Sold] => 32 [6] => 42 [Price] => 42 ) [4] => Array ( [0] => 5 [Index] => 5 [1] => 200 caractere si speci8ale #@$#ET$^%%$^^* [Name] => ab [2] => ab [Description] => ba [3] => [Path] => [4] => 123 [Executed] => 123 [5] => 0 [Sold] => 0 [6] => 12.2 [Price] => 12.2 ) )I mean something like $result1, $result2 or something and auto-incrementing.... I would then use that to display just That row.
Would implode() do the job?