Hey everyone,
I'm working with PHPRunner on the Report Page: Before SQL query. I'm putting in a case statement that looks something like this:
switch ($_GET["pg"]) {
case "ICB":
$strWhereClause = whereAdd($strWhereClause,"Products.ProdGrpCode='ICB'");
break;
case "CCB";
$strWhereClause = whereAdd($strWhereClause,"Products.ProdGrpCode='CCB'");
break;
case "EB":
$strWhereClause = whereAdd($strWhereClause,"Products.ProdGrpCode='EB'");
break;
case "PS":
$strWhereClause = whereAdd($strWhereClause,"Products.ProdGrpCode='PS' OR ProdGrp.ProdGrpCode='PS2'");
break;
...
break;
I'm sure that my $_GET is working; I've tested it elsewhere on the page. When I run this, though, I get the following error:
SELECT original.*, `EngProductGroup` as `grp0`, `ProdEngName` as `grp1` FROM (SELECT `ProdGrp`.`ThaiProductGroup`, `ProdGrp`.`EngProductGroup`, `Products`.`ProdEngName`, `Products`.`Picture`, `Products`.`ThaiModel`, `Products`.`EngModel`, `Products`.`ProdWt`, `Products`.`PriceRetail`, `Products`.`PriceWholeSale`, `Products`.`Status`, `Products`.`ProdThaiName`, **`Products`.`ProdGrpCode`**, `ProdGrp`.`ProdGrpCode` as `ProdGrpCode1` FROM Products INNER JOIN ProdGrp ON Products.ProdGrpCode = ProdGrp.ProdGrpCode **WHERE (Status='O') and (Products.ProdGrpCode='CCB'**) ) original**WHERE (Status='O') and (Products.ProdGrpCode='CCB'**) ORDER BY `EngProductGroup` ASC , `ProdEngName` ASC
MySQL said:
#1054 - Unknown column 'Products.ProdGrpCode' in 'where clause'
As you can see there, Products.ProdGrpCode is clearly in my query and is a column in the table. I'm not sure why there are two where statements generated; my base query doesn't have any, and I'm sure I'm not adding it on twice. Does anyone have any insight into this?
Thanks.
Tim