php - SELECT * FROM tbl WHERE col1=$var1 and col2=$var2 and col3=$var3 -


music database site:
have table named ps_albums columns: artist, album, genre_id, , on. have second table named ps_users following column: user_id, date_joined, fave_genre_1, fave_genre_2, fav_genre_3 , other.

my overall goal display genres of music user selects top 3 favorite selections.

i able insert genre_id of 3 favorite genre selections ps_profiles hold info. need able pull 3 genres_id's , display them instead off genres default.

so default select * ps_albums order desc;

thus displaying albums on front page.

now, when user clicks 'my favorite genres' this...

$query= "select *  `ps_profiles` `user_id`= $user_id"; $row = @mysql_fetch_object(@mysql_query($query));  $genre1 = $row->fav_genre_1; $genre2 = $row->fav_genre_2; $genre3 = $row->fav_genre_3; 

i want able display records ps_albums according 3 favorite selections ps_profiles. how setup select statement?

select * ps_albums genre=$genre1 , genre=$genre2 , genre=$genre3 

how go this? there more 10 genres want show ones selected favorites 3 columns. hopes clarifys bit more.

select * ps_albums genre in ($genre1,$genre2,$genre3) 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -