RE: Re: Help: Database Search

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

 



--- Graham Cossey <graham@xxxxxxxxxxxxxxx> wrote:

> Hi Stuart
> 
> Not sure what's happening with the $Ind variable,
> maybe check the $_POST
> array as you enter the script to ensure that the
> form is passing the data
> correctly. It is almost as if you are appending it
> to itself at some point.
> You don't have a line like this anywhere do you :
> $Ind[] = $Ind;  OR maybe 2
> of: $Ind[] = $_POST['Ind']; ??
> 
> Part of the problem is with the implode statement.
> It is this that is not
> adding the initial and final ' to your IN statement,
> see below:
> 
>   if (count($Ind) > 0)
>   {
> 
>     $IndStr = implode("','", $Ind);
>     $where[] = "VendorJobs.Industry IN('$IndStr')";
>                                        ^-------^
>   }else{
>     $where[] = "VendorJobs.Industry = {$Ind[0]}";
> }
> 
> I would also remove this line:
> $Ind[] = "";
> 
> HTH
> Graham
> 
I think it's working , at least I get results now with
no error messages.  Still some work to go on the
script.  Here is the current initializatin and sql
code:

$Ind = $HTTP_POST_VARS['Ind'];
if (count($Ind) > 0 AND is_array($Ind)) {
    $s_Ind = "'".implode("','", $Ind)."'";
}

I guess here I should put this in braces as it should
be conditional if $Ind is set, if not the subsequent
sql statement shouldn't go in.

if ($Ind) 
$sql .= " WHERE VendorJobs.Industry IN ($s_Ind)";

Stuart

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