This topic is locked

Where Active ='Yes'in custom code

2/4/2008 4:31:27 PM
PHPRunner General questions
M
mmponline author

I have the following custom code:

global $conn,$smarty;

$rowsearch=array();

$rstt = db_query("SELECT TropicProducts.Materials, Count(TropicProducts.Materials) AS CountOfMaterials FROM TropicProducts GROUP BY TropicProducts.Materials", $conn);

$ind=0;

while($data=db_fetch_array($rstt))

{

$rows=array();

$MaterialsName = str_Replace(" ","+",$data["Materials"]);

$rows["href"]="TropicProducts_list.php?a=search&value=1&SearchFor=".$MaterialsName."&SearchOption=Contains&SearchField=Materials";

$rows["1Materials_value"]=$data["Materials"]." (".$data["CountOfMaterials"].")<br>";

$rowsearch="<a href=\"".$rows["href"]."\">".$rows["1Materials_value"]."</a>";

echo $rowsearch;

}


I need to add a filtered query Where Active = "Yes".. If I do it like this:

global $conn,$smarty;

$rowsearch=array();

$rstt = db_query("SELECT TropicProducts.Materials, Count(TropicProducts.Materials) AS CountOfMaterials FROM TropicProducts WHERE Active="Yes" GROUP BY TropicProducts.Materials", $conn);

$ind=0;

while($data=db_fetch_array($rstt))

{

$rows=array();

$MaterialsName = str_Replace(" ","+",$data["Materials"]);

$rows["href"]="TropicProducts_list.php?a=search&value=1&SearchFor=".$MaterialsName."&SearchOption=Contains&SearchField=Materials";

$rows["1Materials_value"]=$data["Materials"]." (".$data["CountOfMaterials"].")<br>";

$rowsearch="<a href=\"".$rows["href"]."\">".$rows["1Materials_value"]."</a>";

echo $rowsearch;

}


I get a parse error.
Please help

A
alang 2/4/2008

Try using single quotes around the 'Yes'