Author Topic: Need help with arrays, select multiple rows when selectorvalue match  (Read 290 times)

0 Members and 1 Guest are viewing this topic.

Offline vaupellTopic starter

  • Irregular
  • Posts: 2
  • Gender: Male
  • Newbie
    • View Profile
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.

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Mind Boggling!'
  • *
  • Posts: 15,443
  • Gender: Male
    • View Profile
Re: Need help with arrays, select multiple rows when selectorvalue match
« Reply #1 on: January 27, 2010, 09:03:53 PM »
I don't follow.
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

Offline vaupellTopic starter

  • Irregular
  • Posts: 2
  • Gender: Male
  • Newbie
    • View Profile
Re: Need help with arrays, select multiple rows when selectorvalue match
« Reply #2 on: January 28, 2010, 07:56:22 AM »
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)