jarv
11-12-2011, 01: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....
SELECT *
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> ';
echo '<a href="approve-image.php?PictureID='.$row2['PictureID'].'" title="Approve">♥</a> ';
echo '<a href="disapprove-image.php?PictureID='.$row2['PictureID'].'" title="Disapprove">◊</a> ';
}
}
SELECT *
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> ';
echo '<a href="approve-image.php?PictureID='.$row2['PictureID'].'" title="Approve">♥</a> ';
echo '<a href="disapprove-image.php?PictureID='.$row2['PictureID'].'" title="Disapprove">◊</a> ';
}
}