Scodigo, Inc.

Log In | Register

Cart Items:
0

Space in Field Names & fm_sql_execute SELECT command

I am trying to use Smart Pill (2.0 beta) and the fm_sql_execute SELECT command on our database but unfortunately some of our field names have spaces in them. Filemaker 9 Advanced (Mac) quits unexpectedly when i try to use a field name with a space.

Example - 'Account ID':
$result = fm_sql_execute(\" SELECT Account ID FROM Account WHERE Creator = 'Jim Smith' \" );

Is there a work around for this, besides renaming our fields =) ?

-Michael

Space in Field Names & fm_sql_execute SELECT command

Micah Woods's picture

Try adding double quotes around the field name like this:

$result = fm_sql_execute("SELECT \"Account ID\" FROM Account WHERE Creator = 'Jim Smith'");

Regards,
Micah

I tried this and get a

I tried this and get a syntax error:

"PHP Parse error: syntax error, unexpected T_STRING in Embedded code on line 1"

I am using this command now:

PHP_Execute( "
$result = fm_sql_execute( \" SELECT \"total chg\" From TransIndex\" );
$resultsArray = explode(chr ('¶'), $result);
var_dump($resultsArray);
" )

Any other suggestions?

Just need a slight change to the way you're escaping

Micah Woods's picture

Try this (notice that the \ is being escaped) :

PHP_Execute( "
$result = fm_sql_execute( \" SELECT \\\"total chg\\\" From TransIndex\" );
$resultsArray = explode(chr ('¶'), $result);
var_dump($resultsArray);
")

Regards,
Micah

So how does one get ones

So how does one get ones hands on the 2.0 beta?

Download it from the link

Download it from the link off the front page.