[FX.php List] error 958 parameter missing from query

Kevin Futter kfutter at sbc.melb.catholic.edu.au
Tue Apr 11 21:23:37 MDT 2006


On 31/3/06 3:39 PM, "Michael Layne" <fx at 9degrees.com> wrote:

> This also might help - it helped us tremendously when we found that smart
> quotes (such as copying/pasting from Word or even values from a FileMaker
> field being sent through Troi URL plug-in) was causing records not to be
> added, etc.:
> 
> first the PHP function:
> 
> function convertSmartQuotes($string) {
>     $search = array(chr(145),
>                     chr(146),
>                     chr(147),
>                     chr(148),
>                     chr(151));
>  
>     $replace = array("'",
>                      "'",
>                      '"',
>                      '"',
>                      '-');
>  
>     return str_replace($search, $replace, $string);
> } 
> 
> 
> then to the incoming values:
>  
>     $q = new FX($ip,$port);
>     $q->SetDBData($db,$lay);
>     $q->SetDBPassword('xxxx','xxxx');
> 
>     //this is the important bit.......................  
>     foreach ($_POST as $key => $value) {
>         $realvalue = convertSmartQuotes($value);
>         $q -> AddDBParam($key, $realvalue);
>     }
>     //.........................................................
>     $r = $q->FMNew();   
> 
> HTH,
> 
> Michael
> 

Michael - I've just today experienced the very problem your function seeks
to address, so thanks for posting it. It took me an hour's worth of hacking
around just to realise that smart quotes were the problem, and you've saved
me the trouble of looking up character codes and writing my own function!

-- 
Kevin Futter
Webmaster, St. Bernard's College
http://www.sbc.melb.catholic.edu.au/





More information about the FX.php_List mailing list