From PikaDocs
> -----Original Message-----
> From: Andrew Cameron
> Sent: Tuesday, September 26, 2006 5:31 PM
> Subject: potential patch for pl_report.php
>
> I have a potential patch here for pl_report.php - the
> function pl_process_comma_vals.
>
> I noticed it doesn't work if you pass a string like "1, 2, 3,
> 4" - it will only function properly if you pass "1,2,3,4" -
> for instance with the LSC Age/Race report and putting these
> values in the status field.
>
> So this patch should handle the spaces between commas. Take
> it if you want it!
>
> Thanks,
> Andrew
/*
Convert a string of comma separated values into SQL code that can be
used with the IN operator
*/
function pl_process_comma_vals($str)
{
$a = explode(",", $str);
$i = 0;
$out = "(";
foreach ($a as $val)
{
// Andrew Cameron 2006/9/26
//if ("" != $val)
if ("" != trim($val))
{
if ($i > 0)
{
$out .= ",";
}
// Andrew Cameron 2006/9/26
//$out .= "\"$val\"";
$out .= '"' . trim($val) . '"';
$i++;
}
}
$out .= ")";
if ($i > 0)
{
return $out;
}
else
{
return false;
}
}