Hello, I have a database structure:
Table Users:
--------------------------------
email (PK) | firstname | lastname
--------------------------------
johndoe@blah.com | John | Doe
then a User can have many interests (multi-valued) so I created another table called interests.
Table Interests:
--------------------
email (FK) | interest
--------------------
johndoe@blah.com | Surfing
johndoe@blah.com | Fishing
Now I want to select all the interests of a user where the email=$email.
I simply did:
Code:
$query="SELECT interest from Interests WHERE email=$email"
However it is only retrieving the FIRST row where email=$email.
i.e. It is returning:
|
johndoe@blah.com | Interests: Surfing.
How can I retrieve ALL values of interest where the email matches?
i.e I want to Display:
|
johndoe@blah.com | Interests: Surfing, Fishing.