image display in second if

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wizardry
    New Member
    • Jan 2009
    • 201

    image display in second if

    the ids and images for the 2nd if statement are pulling the 1st record information to generate the record. how do i change this to where the if statement grabs the correct record and not the referring one.

    thanks in advance for your help!

    Code:
    <?php
    $result = mysql_query("SELECT a.Id, a.Type, 
    a.Dates, 
    a.Uidfk as Uidfk, 
    b.Id as Did, 
    b.comment as Comment, 
    b.dates as Day, 
    b.sfk as Sfk ,
    c.sfk as sfk1, 
    d.Memo as Memo,
    d.Date as Dates1,
    aes_decrypt(e.ProfileName, '$Ukey') as Name,
    substr(i.Path, 4) as Path
    FROM 
    asstatusupdate as a   
    left join asstatusdata as b 
    on a.id = b.sfk 
    left join asmanystatusupdate as c
    on b.sfk = c.sfk
    left join ascomments as d
    on d.id = c.cfk
    right join onlyonew_hquis.ASWebInfo as e
    on e.Uidfk = a.uidfk
    right join onlyonew_hqups.ASManyAlbums as f
    on f.UserId=a.uidfk
    right join onlyonew_hqups.ASAlbums as g
    on f.AlbumId=g.Id
    right join onlyonew_hqups.ASTitle as h
    on g.Id=h.AlbumId
    right join onlyonew_hqups.ASData as i
    on h.Id=i.TitleId
    where a.uidfk in (select friendid from onlyonew_hquis.asfriends where uidfk0='1') and i.DefaultProfilePic='Y' order by dates desc;
    
    ");
    
    $result1 = mysql_query("SELECT a.Id, a.Type, 
    a.Dates, 
    a.Uidfk as Uidfk, 
    b.Id as Did, 
    b.comment as Comment, 
    b.dates as Day, 
    b.sfk as Sfk ,
    c.sfk as sfk1, 
    d.Memo as Memo,
    d.Date as Dates1,
    aes_decrypt(e.ProfileName, '$Ukey') as Name,
    substr(i.Path, 4) as Path
    FROM 
    asstatusupdate as a   
    left join asstatusdata as b 
    on a.id = b.sfk 
    left join asmanystatusupdate as c
    on b.sfk = c.sfk
    left join ascomments as d
    on d.id = c.cfk
    right join onlyonew_hquis.ASWebInfo as e
    on e.Uidfk = a.uidfk
    right join onlyonew_hqups.ASManyAlbums as f
    on f.UserId=a.uidfk
    right join onlyonew_hqups.ASAlbums as g
    on f.AlbumId=g.Id
    right join onlyonew_hqups.ASTitle as h
    on g.Id=h.AlbumId
    right join onlyonew_hqups.ASData as i
    on h.Id=i.TitleId
    where a.uidfk in (select friendid from onlyonew_hquis.asfriends where uidfk0='1') and i.DefaultProfilePic='Y' and c.sfk = '$comment_id' order by dates desc; 
    ");
    
    $category_id = '';
    
    while ($row = mysql_fetch_assoc($result)) {
      if ($row['Id'] != $category_id) {
          //Output the markup for a new category here.
          $category_id = $row['Id'];
      
    		$Cat = $row['Type'];
    		$Memo = $row['Comment'];
    		$Did = $row['Did'];
    		$Dates = $row['Day'];
    		$Name = $row['Name'];
    		$Path = $row['Path'];
    		$FriendId = $row['Uidfk'];
    		
    		echo '<table align="center" width="40%" border="3" cellpadding="0" cellspacing="0">'; 
    		echo '<tr>';
    		echo '<td align="center">'; echo "$Name"; echo "</br>"; echo  '<a href="source/source.php?FriendId=' ."$FriendId". '"><img src="' ."$Path". '" height="120" width="120" align="middle" border="3" /></a>'; echo '</td>';
    		echo '<td align="center"> '; echo "$Dates" ; echo "</br>"; echo "</br>"; echo "$Cat"; //echo "</td>";
    	    echo "</br>"; 
    		 echo "$Memo"; echo '</td>'; // echo "</br>";
    		echo '<td>'; echo "$Did" ; echo '</td>'; 
    		echo '</tr>';
    	    echo '</table>';
    		  
      }
      // Output comment markup here
          //	$comment_id = '';
    	  //while ($row1 = mysql_fetch_assoc($result1)){
    	   if(!empty($row['sfk1'])){
      	//	$comment_id = $row['sfk1'];
    		
    		$Fk = $row['sfk1'];
      		$Memo1 = $row['Memo'];
    		$FriendId1 = $row['Uidfk'];
    		$Dates1 = $row['Dates'];
    		$Path1 = $row['Path'];
    		
    		// echo "$comment_id";
    	    echo '<table align="center" width="500" border="3" cellpadding="7" cellspacing="0">'; 
    		echo '<tr>';
    		echo '<td align="center">'; echo "$Name"; echo "</br>"; echo  '<a href="source/source.php?FriendId=' ."$FriendId1". '"><img src="' ."$Path1". '" height="120" width="120" align="middle" border="3" /></a>'; echo '</td>';
    		echo '<td>'; echo "$Fk"; echo '</td>'; 
    	   // echo "</br>"; 
    		echo '<td align="center">'; echo "$Dates1"; echo "</br>"; echo "</br>"; echo "$Memo1"; echo '</td>'; 
    		// echo "</br>";
    		echo '</tr>';
    		echo '</table>';
    			
    		} // closing if
    		//	} // closing while
    } // closing main
    ?>
Working...