Dan_Mason Posted July 6, 2010 Share Posted July 6, 2010 Hello I am having trouble retrieving an array in the format I need from a mysql database. It is a Matrix/Multidimensional Array, and should look like this: Array( Array(Date => 22/04/1989, Time =>02:00) Array(Date => 23/04/19...... etc For some reason it is coming back like this: Array( Array( Array(22/04/1989), Array(02:00) ) Array( Array(23/04/19...... etc This is the code that puts the mysql result in the array: <?php while ($aTemp[] = mysql_fetch_array($result, MYSQL_NUM)); ?> Any suggestions would be very useful! Thanks! Dan Quote Link to comment https://forums.phpfreaks.com/topic/206881-issue-retrieving-array-from-mysql-database/ Share on other sites More sharing options...
ChemicalBliss Posted July 6, 2010 Share Posted July 6, 2010 while ($row = mysql_fetch_array($result, MYSQL_NUM)){ $aTemp[]['Date'] = $row[0]; $aTemp[]['Time'] = $row[1]; } Hope this helps, -cb- Quote Link to comment https://forums.phpfreaks.com/topic/206881-issue-retrieving-array-from-mysql-database/#findComment-1081946 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.