[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
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:confu...@icube.co.uk] Sent: 23 April 2009 11:04 To: php-db@lists.php.net 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
[PHP-DB] Re: PHP and table/view names with '$'
Mark Casson wrote: 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 Try enclosing your query in single quotes so php doesn't try to expand what it sees as the variable $sql. For example $stmt = OCIParse($conn, 'SELECT * FROM v$sql'); Cheers -- David Robley I am Homer of Borg. Prepare to be assim... , donuts. Today is Pungenday, the 40th day of Discord in the YOLD 3175. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and table/view names with '$'
What if you use back-quotes `` around the table/view name? $stmt = OCIParse($conn, SELECT * FROM `v$sql`); - Original Message - From: n.a.mor...@bton.ac.uk To: Mark Casson confu...@icube.co.uk; php-db@lists.php.net 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:confu...@icube.co.uk] Sent: 23 April 2009 11:04 To: php-db@lists.php.net 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP and table/view names with '$'
Hi Guys, Thanks to you both - you are spot on! Shame this is not better documented somewhere. Mark Mark Casson confu...@icube.co.uk wrote in message news:89.4e.33545.c2d30...@pb1.pair.com... 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
Re: [PHP-DB] PHP and table/view names with '$'
Hi, For reference, this didn't work, but just using single quotes instead of double quotes did. Mark Yves Sucaet yves.suc...@usa.net wrote in message news:006201c9c3ff$4896f7e0$0402a...@rincewind... What if you use back-quotes `` around the table/view name? $stmt = OCIParse($conn, SELECT * FROM `v$sql`); - Original Message - From: n.a.mor...@bton.ac.uk To: Mark Casson confu...@icube.co.uk; php-db@lists.php.net 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:confu...@icube.co.uk] Sent: 23 April 2009 11:04 To: php-db@lists.php.net 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: PHP and table/view names with '$'
Hi, Of course, the next problem is that i want to specify a line to find: $stmt = OCIParse($conn, 'SELECT * FROM v$sql WHERE INSTR(SQL_TEXT,'something')0'); and i seem to have to use single quotes in the INSTR function. Is there an alternative way to deal with that? Thanks again Mark Mark Casson confu...@icube.co.uk wrote in message news:89.4e.33545.c2d30...@pb1.pair.com... 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
Re: [PHP-DB] PHP and table/view names with '$'
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: n.a.mor...@bton.ac.uk To: Mark Casson confu...@icube.co.uk; php-db@lists.php.net 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:confu...@icube.co.uk] Sent: 23 April 2009 11:04 To: php-db@lists.php.net 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP and table/view names with '$'
Switch back to double quotes? :-) $stmt = OCIParse($conn, SELECT * FROM v\$sql WHERE INSTR(SQL_TEXT,'something')0); - Original Message - From: Mark Casson confu...@icube.co.uk To: php-db@lists.php.net Sent: Thursday, April 23, 2009 6:10 AM Subject: [PHP-DB] Re: PHP and table/view names with '$' Hi, Of course, the next problem is that i want to specify a line to find: $stmt = OCIParse($conn, 'SELECT * FROM v$sql WHERE INSTR(SQL_TEXT,'something')0'); and i seem to have to use single quotes in the INSTR function. Is there an alternative way to deal with that? Thanks again Mark Mark Casson confu...@icube.co.uk wrote in message news:89.4e.33545.c2d30...@pb1.pair.com... 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
RE: [PHP-DB] Re: PHP and table/view names with '$'
On 23 April 2009 11:36, Mark Casson advised: Hi Guys, Thanks to you both - you are spot on! Shame this is not better documented somewhere. I don't know how much better documented it can be than at http://php.net/language.types.string ... ;) Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP and table/view names with '$'
Noted! :) Ford, Mike m.f...@leedsmet.ac.uk wrote in message news:93ed589e60ba254f97435fe6c97f2c6702b92...@leedsmet-exch1.leedsmet.ac.uk... On 23 April 2009 11:36, Mark Casson advised: Hi Guys, Thanks to you both - you are spot on! Shame this is not better documented somewhere. I don't know how much better documented it can be than at http://php.net/language.types.string ... ;) Cheers! Mike -- Mike Ford, Electronic Information Developer, C507, Leeds Metropolitan University, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: PHP and table/view names with '$'
i was absolutely convinced that i tried to escape the $ and it hadn't worked and got side tracked looking at other options . . . but yes, that indeed works perfectly. Thanks a lot! Yves Sucaet yves.suc...@usa.net wrote in message news:007d01c9c404$97d4d1b0$0402a...@rincewind... Switch back to double quotes? :-) $stmt = OCIParse($conn, SELECT * FROM v\$sql WHERE INSTR(SQL_TEXT,'something')0); - Original Message - From: Mark Casson confu...@icube.co.uk To: php-db@lists.php.net Sent: Thursday, April 23, 2009 6:10 AM Subject: [PHP-DB] Re: PHP and table/view names with '$' Hi, Of course, the next problem is that i want to specify a line to find: $stmt = OCIParse($conn, 'SELECT * FROM v$sql WHERE INSTR(SQL_TEXT,'something')0'); and i seem to have to use single quotes in the INSTR function. Is there an alternative way to deal with that? Thanks again Mark Mark Casson confu...@icube.co.uk wrote in message news:89.4e.33545.c2d30...@pb1.pair.com... 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
Re: [PHP-DB] Re: PHP and table/view names with '$'
This is well-documented in the String part of the Data Types section: http://www.php.net/manual/en/language.types.string.php -Rasmus Mark Casson wrote: Hi Guys, Thanks to you both - you are spot on! Shame this is not better documented somewhere. Mark Mark Casson confu...@icube.co.uk wrote in message news:89.4e.33545.c2d30...@pb1.pair.com... 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