accessing data from an array within an array.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello all.

im trying to make a function that fetches all rows in the database and stores each row (Array) within an array.

so the code is as follows: 

public function fetch_all($table_name,$order = "DESC"){
			$array['row'] = array();
			strtoupper($order);
			$query = "SELECT * FROM `{$table_name}` ORDER BY id {$order}";
			$result = $this->gen_query($query);
			while($row = $this->fetch_assoc($result)){
				$array['row'][] = $row;
			}
			
			if($this->sql_error_check($result)){
				return $array;
			}
		}

this returns (ill just paste 1 row for the sake of the email length:

Array ( [row] => Array ( [0] => Array ( [id] => 9 [name] => TESTER [title] => TESTER [heading] => TESTER [text] =>

TESTER
[gallery_id] => 0 [meta_desc] =>

TESTER
[meta_keywords] => TESTER [meta_author] =>

 

TESTER
[page_id] => 0 [date_time] => 2011-05-07 06:49:39 [image] => [user_access_id] => 1 ) 

How do i access each array within the array and throw out the data for each one.

im pretty confused on this one.

any help would be appreciated.

Adam
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux