Jump to content

unwanted looping


madcrazy1

Recommended Posts

Strange thing occurs:

if i upload 2 apple pics

the code below outputs both pics twice , so i get an original 2 then a duplicate

2

 

if i upload 3 apple pics the code outputs 9! two duplicates

 

THIS DOSENT HAPPEN IF I ONLY UPLOAD 1 PIC, IT  DOSENT ECHO IT TWICE SO TO SPEAK

please help

 

there is only 5 fruits in the row called 'make'

 

 

 

 

 

 

 

<?
$RunThisQuery = "SELECT * FROM frm_photos WHERE userid=".$_REQUEST['id'];
	$results = $connector->query($RunThisQuery);
while ($row = $connector->fetchArray($results)){
		$make1= $row['make'];



?>
  <? if($make1 =='apples'){ ?>
<br>
<img src='/images/picbox/apples.gif' border='0' style="margin-left:25px;"><a name='22'></a><br>
<table width="100%" cellspacing="2" cellpadding="2" style="margin-left:18px;">
        <tr> 
          <td><? print $Blog3; ?></td>
        </tr>
        <tr> 
                <?
$PIC_LINK = Q("SELECT sValue AS result FROM frm_settings WHERE sid =16",$connector);
	$RunThisQuery ="SELECT * FROM frm_photos WHERE userid=".$_REQUEST['id']." and frm_photos.make='apples' ORDER BY frm_photos.default DESC ";
	$result = $connector->query($RunThisQuery);
	$num_got = $connector->fetchNumResult($result);	
	if ($num_got > 0){		
		 while ($row = $connector->fetchArray($result)){  
		 $img_alt = substr($row['title'], 0, 50);

	$box1 = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr> 
          <td align='center' height='100'> <table cellpadding='0' cellspacing='0' border='0' bgcolor='#000000'>
              <tr> 
                <td> <table width='100%' cellpadding='0' cellspacing='0' border='0' class=''>
                    <tr> 
                      <td><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><img border='3' src='".$PIC_LINK.$row['bigimage']."' alt='".$row['title']."'></a></td>
                    </tr>
                  </table>


</td>
              </tr>
            </table></td>
        </tr>
      </table>
<table width='160' align='center' cellpadding='0' cellspacing='0' bordercolor='#ffffff'>
  <tr> 
          <td> <table width='100%' border='0' cellpadding='0' cellspacing='1' bordercolor='#ffffff' bgcolor='#FFFFFF'>
        <tr bgcolor='#000000'> 
          <td align='center'><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><font color='#FFFFFF' size='2'><crisp>".$img_alt."..</crisp></font></a>
</td></tr></td></tr></table></td></tr></table><br><br>";


			if($boxrow%3){print "<td>".$box1."</td>";}else{print "<td>".$box1."</td></tr>";}
			$boxrow++;
?>
		<? } } ?> <br></td>
        </tr>
        <tr> 
          <td height="20"> </td>
        </tr>
      </table>
<? } ?> <? if($make1 =='peaches'){ ?>
<br>
<img src='/images/picbox/peaches.gif' border='0' style="margin-left:25px;"><a name='22'></a><br>
<table width="100%" cellspacing="2" cellpadding="2" style="margin-left:18px;">
        <tr> 
          <td><? print $Blog3; ?></td>
        </tr>
        <tr> 
                <?
$PIC_LINK = Q("SELECT sValue AS result FROM frm_settings WHERE sid =16",$connector);
	$RunThisQuery ="SELECT * FROM frm_photos WHERE userid=".$_REQUEST['id']." and frm_photos.make='peaches' ORDER BY frm_photos.default DESC ";
	$result = $connector->query($RunThisQuery);
	$num_got = $connector->fetchNumResult($result);	
	if ($num_got > 0){		
		 while ($row = $connector->fetchArray($result)){  
		 $img_alt = substr($row['title'], 0, 50);

	$box1 = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
        <tr> 
          <td align='center' height='100'> <table cellpadding='0' cellspacing='0' border='0' bgcolor='#000000'>
              <tr> 
                <td> <table width='100%' cellpadding='0' cellspacing='0' border='0' class=''>
                    <tr> 
                      <td><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><img border='3' src='".$PIC_LINK.$row['bigimage']."' alt='".$row['title']."'></a></td>
                    </tr>
                  </table>


</td>
              </tr>
            </table></td>
        </tr>
      </table>
<table width='160' align='center' cellpadding='0' cellspacing='0' bordercolor='#ffffff'>
  <tr> 
          <td> <table width='100%' border='0' cellpadding='0' cellspacing='1' bordercolor='#ffffff' bgcolor='#FFFFFF'>
        <tr bgcolor='#000000'> 
          <td align='center'><a href='/ac/i2_index.php?page=preview&photo_id=".$row['id']."&image=".$row['bigimage']."'><font color='#FFFFFF' size='2'><crisp>".$img_alt."..</crisp></font></a>
</td></tr></td></tr></table></td></tr></table><br><br>";


			if($boxrow%3){print "<td>".$box1."</td>";}else{print "<td>".$box1."</td></tr>";}
			$boxrow++;
?>
		<? } } ?> <br></td>
        </tr>
        <tr> 
          <td height="20"> </td>
        </tr>
      </table>
<? } ?>

Link to comment
https://forums.phpfreaks.com/topic/104748-unwanted-looping/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.