random1 Posted August 28, 2008 Share Posted August 28, 2008 How can you create an associative array with a labeled (text not numbered) key in PHP? My current function brings back records from a mysql database as an associative array with a numbered index. e.g. $results['text']['text_value] Can I get it to use $results[4]['text_value'] instead? Link to comment https://forums.phpfreaks.com/topic/121786-associative-arrays-with-a-labeled-key/ Share on other sites More sharing options...
kenrbnsn Posted August 29, 2008 Share Posted August 29, 2008 Please post your code. Ken Link to comment https://forums.phpfreaks.com/topic/121786-associative-arrays-with-a-labeled-key/#findComment-628295 Share on other sites More sharing options...
akitchin Posted August 29, 2008 Share Posted August 29, 2008 while i agree that seeing your code would help, it may be as simple as switching mysql_fetch_assoc() to mysql_fetch_array(). just posting this in case it solves your question pre-emptively. Link to comment https://forums.phpfreaks.com/topic/121786-associative-arrays-with-a-labeled-key/#findComment-628300 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.