> I am new to php and I am wondering if it is possible to use a javascript
> variable in a php statement for example:
>
> // create sql statement
>
> $sql = "select * from main where businesstype = "consultancy" and
> top.upper.villagename = != "0";";
As far as I know, no. Unless "top.upper.villagename" is a field in your
database and the rest is that field's contents (couldn't be ... too many
unescaped double quotes and semicolons). Nope, SQL statements don't work
like that and can only refer directly to data in a database, not php or
any other variables.
You might consider using if statements something like this:
if ($top.upper.villagename != '0') {
$sql = "SELECT * FROM main WHERE business = 'consultancy'";
}
Hope this helps
Mick
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]