Mystified about making a PHP double-query dynamic list work. Using PHP 5.3.5 -


i'm trying create dynamic list (5 row results) in php first getting data 1 table using resulting var latest uploaded "image_links" (just 1 each of 5 artists) table -- echo out.

the code here gives me 1 row latest image. when comment out "// latest image link uploaded ///" section of code 5 rows of different artists want but, of course, w/o images. tried (among bunch of things) mysql_result() w/o while statement didn't work.

so missing?

thanks allen

  //// first artists followed  ////////////////   $query= "select * followartist  user_id = $user_id ";      $res = mysql_query($query);     $num = mysql_num_rows($res);     if($num>0){          while($row = mysql_fetch_array($res)){          $artist_name = $row['artist_name'];          $artist_id = $row['artist_id'];                   $date_lastsent = $row['date_lastsent'];          $date_artposted = $row['date_artposted'];          $date_noteposted = $row['date_noteposted'];  //// new notice data /////                      if ($date_artposted >= $date_lastsent) {               $artp = "new artwork posted";                }else{               $artp = "";                 }           if ($date_noteposted >= $date_lastsent) {               $notep = "news/announcement posted";                }else{               $notep = "";                }           if ($artp!="" && $notep!="") {               $and = " and<br />";                }else{               $and = "";                  }           if ($artp=="" && $notep=="") {               $no = "no new images or news posted since your<br /> last visit, we'll let know when there is.";                }else{               $no = "";               }   //////// latest image link uploaded ////////////////////////////////////            $query2="select image_link artwork artist_id ='$artist_id' , make_avail = '1'  ";             //order date_submit desc             $res = mysql_query($query2);             $num = mysql_num_rows($res);             if($num>0 ){                 while($row = mysql_fetch_assoc($res)){                   mysql_fetch_assoc($res);                  $image_link= $row['image_link'];                 }     //////// end of latest images uploaded ////////////////////////////////                           echo "<tr align=\"center\" height=\"115px\">                 <td align=\"left\" width=\"15%\"> <a href=\"process_artist_idimages.php?artist_id=$artist_id&search=search\">                                     <img src=slir/w115-h115/$path$image_link /></a></td>                  <td align=\"center\" width=\"80%\"                                     <span class=\"devicemedltgrayfont\">$artist_name</span>                                     <br /><br />                                     <a href=\"process_artist_idimages.php?artist_id=$artist_id&search=search\"/>                                     $artp</a>                                     <a href=\"process_artist_idimages.php?artist_id=$artist_id&search=search\"/>                                     $and$no</a>                                     <a href=\"process_artist_idimages.php?artist_id=$artist_id&search=search\"/>                                     $notep</a>                                     </td>                 </tr>";         }  //// end bracket getting latest image link    } ///loop end getting followed artist data } ///end: if ($num>0) clause<code>  

if read code correctly, see looping using data query1 in control structure, , lookup on query2 within each loop. reusing variables in loop1 control structure query2 ($num , query handle ($res)) second loop. not desirable within loop.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -