kakster Posted May 20, 2010 Share Posted May 20, 2010 I've hit a wall trying to get MDB2 to give me the results of my database query in the format I want. I'm probably misunderstanding something about MDB2, so please enlighten me. The SQL below, when executed from a MySQL command line, returns what I want: First Building Name Second Building Name Third Building Name Forth Building Name ... so I know it's not the SQL causing the problem. Now the MDB2 code: $sql = 'SELECT DISTINCT Property FROM Table1 INNER JOIN Table2 ON Table1.Id=Table2.Table1Id ORDER BY Property ASC'; $result = $mdb2->query($sql); errorCheck($result); // Check that result is not an error. $data = $result->fetchAll(MDB2_FETCHMODE_ORDERED); // Gives an array of all rows at once. $result->free(); // Free all memory associated with queries. print_r($data); MDB2 returns the data in this format: Array ( [0] => Array ( [0] => First Building Name ) [1] => Array ( [0] => Second Building Name ) [2] => Array ( [0] => Third Building Name ) [3] => Array ( [0] => Forth Building Name ) ) I want the data in this format instead: Array ( [0] => First Building Name [1] => Second Building Name [2] => Third Building Name [3] => Forth Building Name ) Thank you :-) Nick Link to comment https://forums.phpfreaks.com/topic/202424-mdb2-query-result-format/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.