This topic is locked
[SOLVED]

 BeforeQueryList Add HAVING 1=0

5/26/2010 10:15:29 PM
PHPRunner General questions
G
gluckett author

I have added the following code to the

"List Page: Before SQL Query"



if (@$_REQUEST["a"]=="search" && $_REQUEST["SearchOption"]=="IN")

{

$strWhereClause = $_REQUEST["SearchField"]." in (".$_REQUEST["SearchFor"].") ";

}


that works great, but the following url adds a HAVING 1=0 to the query

http://localhost/kory/Parcels_list.php?SearchOption=IN&SearchField=ID&SearchFor=1,2,3&a=search


Error line 38

SQL query SELECT ID, ADDRESS, STNAME, APN, ACRES, AREA, LAND_VALUE, IMP_VALUE, NET_VALUE FROM Parcels where ID in (1,2,3) having 1=0**__ ORDER BY 5 DESC

A
ann 5/27/2010

Hi,
this erros arises since you've used usual search to perform a custom search. Change "search" to "customsearch".

Here is a code:

if (@$_REQUEST["a"]=="customsearch" && $_REQUEST["SearchOption"]=="IN")

{

$strWhereClause = $_REQUEST["SearchField"]." in (".$_REQUEST["SearchFor"].") ";

}



and the corresponding url is:



http://localhost/kory/Parcels_list.php?SearchOption=IN&SearchField=ID&SearchFor=1,2,3&a=customsearch
G
gluckett author 5/27/2010

Thanks Worked Like a Charm!