PHP / MySQL Associative Multidimensional Array:
Posted on
16th Feb 2014 07:03 pm by
admin
Hello.
I have data in a MySQL Table that adheres to the below: (note, no index, could add if necessary)
group~~~~~setting~~~~~value
1~~~~~~~~~Babble~~~~~Yeah, sure
1~~~~~~~~~Dabble~~~~~No, rather not
2~~~~~~~~~Crab~~~~~~~Maybe
3~~~~~~~~~Flab~~~~~~~Nah, not today
I want to query this and add it to an associative multidimensional array.
I have the following:
Line number On/Off | Expand/Contract $getem = array(array()); while ($row = mysql_fetch_assoc($result)) { $getem[][] = $row['group']; $getem[][] = $row['setting']; $getem[][] = $row['value']; }
Of course, this is not associative. I thought if I changed $getem = array(array()); to $getem = array( array('group', 'setting', 'value') );, then it would be associative, but this isn't working.
My ultimate goal is this:
I have a second table in which the 'group' of the above table is a FK to the index of the second table. The end result, once processed and matched using PHP, is to print out the following:
Group Name 1
~~~Babble~~~Year, sure
~~~Dabble~~~No, rather not
Group Name 2
~~~Crab~~~~Maybe
Group Name 3
~~~Flab~~~~Nah, not today
Am I on the right track? You don't need to write the code for me, I'm just looking for a little direction.
Thanks
No comments posted yet
Your Answer:
Login to answer
283
35
Other forums
ASP.NET 2.0 - Enter Key - Default Submit Button
Hi,One of the most annoying things in developing web pages is handling the "Enter key" for form subm
subtract 1 from value entered in text field
Hi
How do I subtract 1 from the vaue entered into a text field?
Thanks
Reading waves
Hi,
I am trying to find a way of finding the highs and lows on a graph line, the line points
Match stored value with the current value in a loop
Hello,
I have a MySQL db were I store articles in.
I have a form to fill these article
Batch update record with Pagination
Hoping someone can help me with this issue I'm having, im trying to batch update records from a resu
$variable = $variable
Hello
Sorry if this is a really simple question but I have run out of ideas. Is there a reall
Getting Resource id #11 while trying to connect..
So i tried using "DEFINE" for the first time and im using the variables i defined to conne
Preloading images
Posting this question here because I am not sure where this should belong.I am building an asp.net a
Showing selected item at top of list
Hi,
I've got a list of names which i am fetching from database like this:
$qry = db_query
Chat Box in PHP
I was thinking in doing a Chat Box in PHP. For that I would use a form with two fields, Nick and Mes