Jump to content

Need help with arrays, select multiple rows when selectorvalue match


vaupell

Recommended Posts

database looks like this

 

id|columa|user|columc

---------------------------

1|dataA|user|selectorid1

2|dataB|user|selectorid2

3|dataC|user|selectorid3

4|dataA|user1|selectorid1

5|dataB|user1|selectorid2

6|dataC|user1|selectorid3

7|dataA|user2|selectorid1

8|dataB|user2|selectorid2

9|dataC|user2|selectorid3

----------------------------

 

What i need is

 

user - dataB

user1 - dataB

user2 - dataB

 

I dont know the values of the usernames/id's and i donot know the dataB contents

i DO know selectorid2

 

so i was thinking something like this

 

$getdataB = SELECT DESTINCT dataB FROM mytable WHERE selectorid2 ;

 

but how do i now show/work with the data from dataB

i was thinking something like

 

foreach $getdataB

{

echo $getdataB;

}

 

which ofcourse didnt work..

 

any help on this matter would be appriciated..  thank you.

I dropped the issue, the database struckture was just to crazy.

 

It allowed a admin of the cms to create costum items, placed between fixed items in a form for the users.

i changed it so the fixed items got structured in its own table and was easy to select,

while the costum now is selected by the selectorid.. 

 

solved, but not like original intended..  8)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.