Re: Re: Help: Database Search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 13 November 2004 20:41, Stuart Felenstein wrote:
> Sorry, I fixed Ind , since the element is named Ind[].
> Now I get a different error:
>
> 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
> '','','Array)' at line 3
>
> > <?php
> > $where = array();
> > $Ind[] = "";
> > $Ind[] = $_POST['Ind'];
> >   if (count($Ind) > 1)
> >   {
> >     $IndStr = implode("','", $Ind);
> >     $where[] = "VendorJobs.Industry IN($IndStr)";
> >   }else{
> >     $where[] = "VendorJobs.Industry = {$Ind[0]}";
> > }
> > ?>
> > <?php
> > $sql = 'SELECT PostStart, JobTitle, Industry,
> > LocationState, VendorID
> >         FROM VendorJobs
> >         WHERE ' . implode( ' AND ', $where );
> >
> > $result = mysql_query($sql) or die ("Query failed: "
> > .mysql_error());
> > while($row = mysql_fetch_assoc($result))
> >
> > I can't find the problem.
> > Anyone see anything ?

Uhmm, you could try some debugging of your own instead of relying on the list. 
Liberally douse your code with print_r() and var_dump() of all your important 
variables. Do they contain what you expected? If not try and figure out why 
not.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Soap and education are not as sudden as a massacre, but they are more
deadly in the long run.
		-- Mark Twain
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux