halojoy wrote:I dont know, but maybe you should post the ORIGINAL code
the one WITH prices.
Obviously you did corrupt something, when removing prices.
Maybe MySQL does no longer return any rows in $result.
here's the original code:
**The goal is ERASE COMPLETLY the list menu:
<?
$i=0;
mysql_connect('******','***********','*************');
$database="*************";
@mysql_select_db("$*****") or die( "Unable to connect to database - please email geral@husse.com.pt");
/*Search database for name*/
$table="Husse_FindFood";
$DogA="";
if ($Active == "1"){ $DogA.="Active,"; }
if ($Normal == "1"){ $DogA.="Normal,"; }
if ($Overweight == "1"){ $DogA.="Overweight,"; }
if ($Pregnant == "1"){ $DogA.="Pregnant,"; }
if ($Itching == "1"){ $DogA.="Itching,"; }
if ($BadStomach == "1"){ $DogA.="BadStomach"; }
$DogDetails = split(",", $DogA);
$BestFood="";
if ($Age<2)
{
$result = mysql_query("select * from $table where DogSize='$DogSize' and Age='$Age';") or die(mysql_error());
$tableno=mysql_num_rows($result);
$i=0;
while ($i < $tableno):
$id=mysql_result($result,$i,"id");
$BestFood=mysql_result($result,$i,"BestFood");
$i++;
endwhile;
}else{
foreach ($DogDetails as $Dogitem ){
if (strlen($Dogitem)>1)
{
$result = mysql_query("select * from $table where DogSize='$DogSize' and Age='$Age' and DogDetails='$Dogitem';") or die(mysql_error());
$i=0;
$tableno=mysql_num_rows($result);
while ($i < $tableno):
$id=mysql_result($result,$i,"id");
$BestFoodA=mysql_result($result,$i,"BestFood");
$BestFood.="$BestFoodA,";
$i++;
endwhile;
}
}
}
$food = split(",", $BestFood);
$foods=array_unique($food);
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"10\" width=\"96%\"><tr><td valign=\"top\">";
$table="Husse_Products";
foreach ($foods as $item ){
$i=0;
$result = mysql_query("select * from $table where id = '$item';") or die(mysql_error());
$tableno=mysql_num_rows($result);
while ($i < $tableno):
if ($j==0){
$bgc="#FEFDF6";
}else{
$j=-1;
$bgc="#F6F9FE";
}
$id=mysql_result($result,$i,"id");
$Title=mysql_result($result,$i,"Title");
$SubTitle=mysql_result($result,$i,"SubTitle");
$Category=mysql_result($result,$i,"Category");
$DescShort=mysql_result($result,$i,"DescShort");
$DescProduct=mysql_result($result,$i,"DescProduct");
$Price=mysql_result($result,$i,"Price");
$DescInfo=mysql_result($result,$i,"DescInfo");
$image=mysql_result($result,$i,"image");
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"5\" width=\"96%\"><tr><td>";
echo "<img src=\"products/$image\" align=\"middle\"></td>";
echo " <td width=\"400\">";
echo " <span class=\"ProductName\">$SubTitle</span>";
echo " <p><B>$DescProduct</b></p><p>$DescInfo<p>";
echo "<form action=\"cart.php\" method=\"GET\"><input type=\"hidden\" name=\"action\" value=\"add_item\">";
echo "<input type=\"hidden\" name=\"type\" value=\"$Title\"><br><select name=\"id\" size=\"1\">\n";
$resultb = mysql_query("select * from $table where Title='$Title' and SubTitle='$SubTitle';") or die(mysql_error());
$tablenob=mysql_num_rows($resultb);
$j=0;
while ($j < $tablenob):
$pid=mysql_result($resultb,$j,"id");
$DescShort=mysql_result($resultb,$j,"DescShort");
$Price=mysql_result($resultb,$j,"Price");
$j++;
echo "<option value=\"$pid\">$DescShort > € $Price</option>";
endwhile;
echo "</select> ";
echo " Quantity : ";
echo "<input name=\"qty\" value=\"1\" type=\"text\" size=\"2\" maxlength=\"3\"> ";
echo "<input type=\"image\" class=\"submit2\" name=\"addtocart\" src=\"images/add2cart.gif\" border=\"0\" height=\"18\" width=\"87\" hspace=\"3\" vspace=\"3\" align=\"absmiddle\">";
echo "</form>\n";
echo "</td></tr></table>";
$i++;
$j++;
endwhile;
}
echo "<tr><td>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"5\" width=\"100%\" background=\"images/red-bgfill.gif\" bgcolor=\"#CE0000\">";
echo "<tr><td width=\"100%\" class=\"WhiteBold\"><img src=\"images/paymentsolutions.gif\" width=\"422\" height=\"25\"></td>";
echo "<td nowrap class=\"Texte\"><a href=\"checkout.php\" class=\"Range\">> Checkout</a> ";
echo " <a href=\"modify-cart.php\" class=\"Range\">> View Cart</a></td>";
echo "</tr>";
echo "</table>";
echo "</td></tr>";
echo " </td></tr></table>\n";
mysql_close();
?>
Thanks