Re: Help: Database Search
| From: | Stuart Felenstein | Date: | Sat, 13 Nov 2004 18:16:17 +0000 |
| Subject: | Re: Help: Database Search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201926@lists.php.net to get a copy of this message | ||
I've changed my logic around but still running into a
sql query error.
I've tried a number of things with no success. Here
is the error that returns on POST:
SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobs WHERE (VendorJobs.Industry =
''1','2','3''Query failed: You have an error in your
SQL syntax. Check the manual that corresponds to your
MySQL server version for the right syntax to use near
'1','2','3''' at line 2 .
Here is the relevant code:
$Ind = $HTTP_POST_VARS['Ind'];
if (count($Ind) > 0 AND is_array($Ind)) {
$Ind = "'".implode("','", $Ind)."'";
}
$sql = "SELECT PostStart, JobTitle, Industry,
LocationState, VendorID
FROM VendorJobs";
//if ($Ind)
$sql .= " WHERE (VendorJobs.Industry = '$Ind'";
I'm not trying to be a pain here. Either I'm not
catching a syntax error or something else.
Stuart