Page 1 of 1

Why is this in a spin and Timing Out?

Posted: Mon May 21, 2012 8:36 am
by simonmlewis
This is checking on the product ID from a string (344|232|112... for ex) and then to see if the Title of that code is "grout", and then if it is, it produces the dropdown list.

It just stopped the timeout but went into a complete spin at line 228, which is
" while ($rowac = mysql_fetch_object($resultancscheck))".

Code: Select all

if ($row->ancillaryoverride == "yes")
{
  $string = "$row->ancillaries";
  $token = strtok($string,"|");
  while($token)
  {
  $resultanccheck = mysql_query ("SELECT title, photoprimary, romancode1, romancode2, romancode3, romancode4, size1, size2, size3, size4 FROM products WHERE id = '$token'")or die(mysql_error()); 
    while ($rowac = mysql_fetch_object($resultancscheck))
    {    
    if (preg_match("/grout/i", "$rowac->title")) 
      { 
      echo "<tr><td><img src='/images/productphotos/small/$rowac->photoprimary' /> </td><td>$rowac->title<br/>Please choose your Grout:<br/>
      <select name='romancode1'>";
      if ($rowac->size1 != '') { echo "<option name='romancode1' value='$rowac->romancode1'>$rowac->size1</option>";}
      if ($rowac->size2 != '') { echo "<option name='romancode2' value='$rowac->romancode2'>$rowac->size2</option>";}
      if ($rowac->size3 != '') { echo "<option name='romancode3' value='$rowac->romancode3'>$rowac->size3</option>";}
      if ($rowac->size4 != '') { echo "<option name='romancode4' value='$rowac->romancode4'>$rowac->size4</option>";}
      echo "</select></td></tr>";
      }
    }
  }
  $token = strtok("|");
}
// end of ancillaryoverride question
echo "</table>";

Re: Why is this in a spin and Timing Out?

Posted: Wed May 23, 2012 8:38 am
by social_experiment

Code: Select all

<?php
while ($rowac = mysql_fetch_object($resultancscheck))
?>
the variable passed to mysql_fetch_object is called $resultancscheck while the one containing the query is $resultanccheck (missing an 's' between the two 'c' s)