RE: Re: Help: Database Search

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

 



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 ?
> 
> Thank you.
> Stuart
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
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