jmurch Posted September 4, 2008 Share Posted September 4, 2008 I have a recordset I am looping thru to populate an array: while(odbc_fetch_row($crs_ready_query_result)) { $vin = odbc_result($crs_ready_query_result, 1); $cr_creation_date = odbc_result($crs_ready_query_result, 2); $cr_path = odbc_result($crs_ready_query_result, 3); This does not work (stops after the first row): $cr_array = array ( $vin => array ($cr_path) ); This does work (loops thru all the rows): $vin[] = $vin; What do I have wrong in the syntax? The multidimensional array looks fine but breaks the loop. TIA, Jeff Link to comment https://forums.phpfreaks.com/topic/122711-solved-looping-multidimesional-array-problem/ Share on other sites More sharing options...
rhodesa Posted September 4, 2008 Share Posted September 4, 2008 are you looking for something like this: <?php $cr_array = array (); while(odbc_fetch_row($crs_ready_query_result)) { $vin = odbc_result($crs_ready_query_result, 1); $cr_creation_date = odbc_result($crs_ready_query_result, 2); $cr_path = odbc_result($crs_ready_query_result, 3); $cr_array[$vin] = $cr_path; } print_r($cr_array); ?> Link to comment https://forums.phpfreaks.com/topic/122711-solved-looping-multidimesional-array-problem/#findComment-633678 Share on other sites More sharing options...
jmurch Posted September 4, 2008 Author Share Posted September 4, 2008 Thanks Link to comment https://forums.phpfreaks.com/topic/122711-solved-looping-multidimesional-array-problem/#findComment-633687 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.