I am building a photo uploading website and I have joined two tables together in order to display the username of the person who uploaded the image. This works but it is printing every name in the database rather than just the image that is selected.
The selected image is called using the following query...
$data = mysql_query("SELECT * FROM photos WHERE id=$imageID");
The following code then attempts to display the username, but I need it to target only the row of the $imageID. How would I do this?
<?php
$query = mysql_query("SELECT username, user_id ".
"FROM users, photos ".
"WHERE (users.id = photos.user_id)");
while($uploader = mysql_fetch_array( $query ))
{
echo $uploader['username']; }
?>
Thanks in advance.