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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.