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
System copy error in RUN ABAP REPORT PHASE
Hi,
I am performing system copy on my test server. I have previously taken export of JAVA + A
Mail functionality from localhost to server
Hi
I am facing problem of mail functionality.
When i tested mail functionality in my
Help with simple query
Hi,
I'm trying to do a Query with a Union where I want to print the number of rows $tc conta
SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign
unexpected T_VARIABLE error
Hey all! I'm getting an unexpected T_VARIABLE with the following function:
function getHighes
A little help needed passing hidden values to next page
I have a page that has hidden values in a form.
example
Code: <input name='signupID
value not going in data base
hello friends....
i am having a working javascript....when i am selecting any
Echo Tweaking help!
HI. I would like to have the output of the entered variables repeat forever, but it's stopping at th
onclick problem
I have <input type="text" name="message">
<a href=page2.
Select Rows as Columns..
is there a way to select COLUMN_NAME from user_tab_columns where table_name='TABLENAME';
and ha