I’m running a query with retrieves user posts. The table Posts has a column with the name of the User who submitted the post, also another table called User has a list of usernames and avatars.
I need to look up in each post for ‘User’ on table Users and if there is a match echo column “Avatar” from this table.
$result = mysql_query("SELECT * FROM Posts WHERE MATCH (City) AGAINST ('$city2') ORDER by `Comments` DESC LIMIT $limit_posts OFFSET $first_post");
while($row = mysql_fetch_array( $result )) { ?>
<div class='item'>
<a href="?city=<?php echo $row['City']; ?>&post=<?php echo $row['PID']; ?>"><?php echo $row['Text']; ?></a>
<? }
1 Answer