Jump to content

[SOLVED] looping multidimesional array problem


jmurch

Recommended Posts

 

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

 

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);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.