![]() Topic awaiting preservation: PHP - Assigning a query result to an assoc array (Page 1 of 1) |
|
---|---|
Neurotic (0) Inmate Newly admitted From: |
![]() Only the last record gets assigned to the array. I dont understand why. code: $resulturl=mysql_query("SELECT title, friendly_url_path, id FROM pmd_v2_locations WHERE level =4 AND friendly_url_path LIKE 'United-States/alabama%' ORDER BY title") or die(mysql_error()); $arrayurl=array(); while($rowl = mysql_fetch_array($resulturl)) { $split = ( list ($Country, $State, $County, $City) = split("/", $rowl[friendly_url_path]) ); $arrayurl['$Country1'] = strtoupper($Country); $arrayurl['$State1'] = strtoupper($State); $arrayurl['$County1'] = strtoupper($County); $arrayurl['$City1'] = strtoupper($City); $arrayurl['$rowlid1'] = $rowl[id]; } foreach ($arrayurl as $key => $value) { echo $key.' - '. $value; }
|
Maniac (V) Mad Scientist with Finglongers From: Germany |
![]() That would be because you have just one level associative arrays. |