Re: [PHP-DB] PHP and table/view names with '$'
[email protected] ("Yves Sucaet")
| Newsgroups | php.db |
|---|---|
| Message-ID | <007801c9c404$6c92e7d0$0402a8c0@rincewind> |
Sorry Mark, It's early in the morning... Neil is right. It's a PHP error you're getting after all, not a SQL Server error. And yes, this is by design: double quotes allow for variable insertion/substitution " ". Single quotes don't ' '. However, if you don't want the $ to be interpreted within the double quotes, you should be able to prevent this by using the backslash \ character. So, we get: $name = "Yves"; $name2 = "$name Sucaet"; // "Yves Sucaet" $name3 = '$name Sucaet'; // "$name Sucaet" $name4 = "\$name Sucaet"; // "$name Sucaet" hth, Yves > ----- Original Message ----- > From: <[email protected]> > To: "Mark Casson" <[email protected]>; <[email protected]> > Sent: Thursday, April 23, 2009 5:25 AM > Subject: RE: [PHP-DB] PHP and table/view names with '$' > > > I find that using single quotes rather than double quotes prevents > variable substitution. > > I don't know if this is an undocumented feature, as the documentation > says that both have the same functionality. > > Regards, > Neil > > -----Original Message----- > From: Mark Casson [mailto:[email protected]] > Sent: 23 April 2009 11:04 > To: [email protected] > Subject: [PHP-DB] PHP and table/view names with '$' > > Hi, > > I am trying to access some of the v$ views using php on iis, with admin > privileges. > > However, using: > > $stmt = OCIParse($conn, "SELECT * FROM v$sql"); > > gives me this error: > > PHP Notice: undefined variable: sql . . . > > Is there a way around this? > > Thanks > > Mark > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >