This topic is locked
[SOLVED]

 Filter Button

10/1/2010 9:03:03 PM
PHPRunner General questions
T
Tempus_Erus author

Hi,
I would like a filter button to filter according to status (Status).
I would like to know if the authorisation (auth code) has been refused or authorised.
I have tried:
$SearchValue="Refused"; ///refused 'button'

global $conn;

$strSQL = "select Status from auth code"; // both the table auth code and field Status are correct in syntax

$rs = db_query($strSQL,$conn);

while ($data = db_fetch_array($rs))$str = "<input type=button class=button value=Filter onclick=\"window.location.href='auth code_list.php?ctlSearchFor=".$SearchValue. "&srchOptShowStatus=1&ctrlTypeComboStatus=0&srchWinShowStatus=0&a=integrated&id=1&criteria=and&type1=&value11=". $SearchValue."&field1=Status&option1=Contains&not1=a=search&value=1';\">";

echo $str;
However I get an SQL query > Table 'authcode.auth' doesn't exist
This is confusing as there is no table authcode.auth it is auth code?
Can anyone shed any light on this or provide a simler solution?
Thanks
TE

J
Jane 10/5/2010

Hi,
you need to add database quotes around field/table names with "bad" characters (quotes, white spaces, etc.).

Here is a sample for MySQL:

$strSQL = "select Status from `auth code`"; // both the table auth code and field Status are correct in syntax

and for MSSQL and MS Access:

$strSQL = "select Status from [auth code]"; // both the table auth code and field Status are correct in syntax