Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question writing out rsUser from an INNER JOIN?

    hi I have executed a SQL in my database and it brings back 2 tables of info as i wanted so that's good....

    Code:
    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?!

    PHP Code:
    $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;';
      }


  • #2
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    it doesnt work cuz you named your mysql result $row1 and not $result1 lol


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •