i've got 3 tables:
Men; with the following columns: image_id, filename Women; image_id, filename Couples; imagemale (to which corresponds image_id from male table),imagefemale,votes
basically the users are shown randomly pictures of men and women and they decide if they would be a good match by voting yes or no, and the table "couples" resumes all this with the votes and the ranking. I'm trying to display the first 25 in number of votes, but in order to show the pictures i need the filenames and not the image id which is all i have.
How can i do it? this is the syntax of the top25 page:
include('mysql.php');
// Get the top25
$results = mysql_query("SELECT * FROM couples ORDER BY votes DESC LIMIT 0,25");
while($row = mysql_fetch_object($results)) $top_ratings[] = (object) $row;
// Close the connection
mysql_close();
and then in the html:
<h2>Top 25</h2>
<center>
<table>
<tr>
<td>
<tr>
<td>
<?php foreach($top_ratings as $key => $filename) : ?>
<td valign="top"><img src="imagesmale/<?=$filename->imagemale?>" /></td>
<?php endforeach ?>
</td>
<td>
<?php foreach($top_ratings as $key => $filename) : ?>
<td valign="top"><img src="imagesmale/<?=$filename->imagefemale?>" /></td>
<?php endforeach ?>
</td>
</tr>
</td>
</tr>
</table>
</center>
Thank you!