$options['where']

5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 28, 2008   (RSS)

By brownleather2 - February 19, 2008 - edited: February 19, 2008

Example: 'fieldname = "value"'

I’d like to call a variable for the value, what do I do? == Example: 'fieldname = "$var"' == dose not work

Re: [brownleather] $options['where']

By Dave - February 19, 2008

You're very close. In PHP variables are only replaced with their values (or "interpolated" as programmer types say) in "double quoted strings". So, basically instead of 'single quotes' use "double quotes" and it will work.

Also, don't forget to escape your variables before you use them in MySQL. Like this:

$escapedVar = escapeMysqlString($var);
$options['where'] = "fieldname = '$escapedVar'";

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [mawebplus] $options['where']

By Dave - March 28, 2008

Hi mawebplus,

Double check your second block of code. If you're calling your options $options2 you want to make sure you're passing that to getRecord as well:

$record = getRecord($options2);

Also, you might want to name your $record variables something else so they don't overwrite each other. For example, $cajasRecord.

Let me know if that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] $options['where']

By mawebplus - March 28, 2008

you guys rock!

finally i madea page with 3 iframes calling 3 different things that the client simply changes on admin fields thnx!!

to share it:

http://www.awebolovendo.com/index.php

the three pics on top