View Full Version : writing out rsUser from an INNER JOIN?

11-12-2011, 02:26 PM
hi I have executed a SQL in my database and it brings back 2 tables of info as i wanted so that's good....

FROM rstarget
INNER JOIN users ON users.UserID = rstarget.UserID
WHERE currentTarget = '1'

so, how am I going to write out the users name? hmm

this doesn't work?!

$query1 = mysql_query("SELECT * FROM rstarget INNER JOIN users ON users.UserID=rstarget.UserID WHERE currentTarget = '1'");
$row1 = mysql_fetch_array($query1);

while($row2 = mysql_fetch_array($result1))
echo '<a href="gallery/'.$row2['FileName'].'" rel="lightbox[ispie]" title="'.$row2['PictureName'].' by '.$row2['rsUser'].'"><img src="thumbs/'.$row2['FileName'].'" /></a>';
if($_SESSION['UserID'] == '1'){
echo '<a href="delete-image.php?PictureID='.$row2['PictureID'].'" title="Delete">X</a>&nbsp;';
echo '<a href="approve-image.php?PictureID='.$row2['PictureID'].'" title="Approve">&hearts;</a>&nbsp;';
echo '<a href="disapprove-image.php?PictureID='.$row2['PictureID'].'" title="Disapprove">&loz;</a>&nbsp;';

11-12-2011, 05:15 PM
it doesnt work cuz you named your mysql result $row1 and not $result1 lol

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum