OZONE Asylum
Forums
Server-Side Scripting - Oh my!
PHP - Assigning a query result to an assoc array
This page's ID:
32306
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
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; } [/code] edit TP: stuck in some code tags. [small](Edited by [url=http://www.ozoneasylum.com/user/1424]Tyberius Prime[/url] on 07-12-2011 09:20)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail