php - Looping through a mysqli result -
i'm trying display list of status updates artists logged in user following.
so far have this:
#get list of artists user has liked $q = "select * artist_likes user_id = '1' "; $r = mysqli_query($dbc,$q); while ($row = mysqli_fetch_array($r, mysqli_assoc)) { #now grab statuses each artist $status_query = "select * status_updates artist_id = '".$row['artist_id']."' "; $status_result = mysqli_query($dbc,$status_query) } but i'm not sure how loop through , display returned status updates?
this isn't strong point of mine, pointers appreciated!
just avoiding multiple query, can use 1 query this:
select l.*, s.* artist_likes l, status_updates s l.artist_id = s.artist_id , l.user_id = '1' or
select l.*, s.* artist_likes l join status_updates s on (l.artist_id = s.artist_id) l.user_id = '1'
Comments
Post a Comment