PHP and table/view names with "$"
PHP and table/view names with "$"
am 23.04.2009 12:04:26 von Mark Casson
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 and table/view names with "$"
am 23.04.2009 12:25:11 von N.A.Morgan
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,=20
Neil
-----Original Message-----
From: Mark Casson [mailto:confused@icube.co.uk]=20
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=20
privileges.
However, using:
$stmt =3D OCIParse($conn, "SELECT * FROM v$sql");
gives me this error:
PHP Notice: undefined variable: sql . . .
Is there a way around this?
Thanks
Mark=20
--=20
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 and table/view names with "$"
am 23.04.2009 12:27:13 von David Robley
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... mmmm, 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 and table/view names with "$"
am 23.04.2009 12:35:53 von Yves Sucaet
What if you use back-quotes `` around the table/view name?
$stmt = OCIParse($conn, "SELECT * FROM `v$sql`");
----- Original Message -----
From:
To: "Mark Casson" ;
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:confused@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 and table/view names with "$"
am 23.04.2009 12:36:28 von Mark Casson
Hi Guys,
Thanks to you both - you are spot on!
Shame this is not better documented somewhere.
Mark
""Mark Casson"" wrote in message
news:89.4E.33545.C2D30F94@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 and table/view names with "$"
am 23.04.2009 12:41:47 von Mark Casson
Hi,
For reference, this didn't work, but just using single quotes instead of
double quotes did.
Mark
""Yves Sucaet"" wrote in message
news:006201c9c3ff$4896f7e0$0402a8c0@rincewind...
> What if you use back-quotes `` around the table/view name?
> $stmt = OCIParse($conn, "SELECT * FROM `v$sql`");
>
>
> ----- Original Message -----
> From:
> To: "Mark Casson" ;
> 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:confused@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 and table/view names with "$"
am 23.04.2009 13:10:22 von Mark Casson
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"" wrote in message
news:89.4E.33545.C2D30F94@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 and table/view names with "$"
am 23.04.2009 13:12:42 von Yves Sucaet
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:
> To: "Mark Casson" ;
> 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:confused@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: Re: PHP and table/view names with "$"
am 23.04.2009 13:13:09 von N.A.Morgan
Escape the embedded single quotes i.e.=20
$stmt =3D OCIParse($conn, 'SELECT * FROM v$sql WHERE=20
INSTR(SQL_TEXT,\'something\')>0');
Neil
-----Original Message-----
From: Mark Casson [mailto:confused@icube.co.uk]=20
Sent: 23 April 2009 12:10
To: php-db@lists.php.net
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 =3D OCIParse($conn, 'SELECT * FROM v$sql WHERE=20
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"" wrote in message=20
news:89.4E.33545.C2D30F94@pb1.pair.com...
> Hi,
>
> I am trying to access some of the v$ views using php on iis, with
admin=20
> privileges.
>
> However, using:
>
> $stmt =3D OCIParse($conn, "SELECT * FROM v$sql");
>
> gives me this error:
>
> PHP Notice: undefined variable: sql . . .
>
> Is there a way around this?
>
> Thanks
>
> Mark
>=20
--=20
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: Re: PHP and table/view names with "$"
am 23.04.2009 13:13:54 von Yves Sucaet
Switch back to double quotes? :-)
$stmt = OCIParse($conn, "SELECT * FROM v\$sql WHERE
INSTR(SQL_TEXT,'something')>0");
----- Original Message -----
From: "Mark Casson"
To:
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"" wrote in message
> news:89.4E.33545.C2D30F94@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: Re: PHP and table/view names with "$"
am 23.04.2009 13:38:15 von M.Ford
On 23 April 2009 11:36, Mark Casson advised:
> Hi Guys,
>=20
> Thanks to you both - you are spot on!
>=20
> 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,=20
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@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: Re: PHP and table/view names with "$"
am 23.04.2009 14:26:56 von Mark Casson
Noted!
:)
""Ford, Mike"" wrote in message
news:93ED589E60BA254F97435FE6C97F2C6702B9255E@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.ford@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: Re: PHP and table/view names with "$"
am 23.04.2009 14:35:40 von Mark Casson
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"" wrote in message
news:007d01c9c404$97d4d1b0$0402a8c0@rincewind...
> Switch back to double quotes? :-)
>
> $stmt = OCIParse($conn, "SELECT * FROM v\$sql WHERE
> INSTR(SQL_TEXT,'something')>0");
>
> ----- Original Message -----
> From: "Mark Casson"
> To:
> 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"" wrote in message
>> news:89.4E.33545.C2D30F94@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: Re: PHP and table/view names with "$"
am 23.04.2009 20:21:40 von Rasmus Lerdorf
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"" wrote in message
> news:89.4E.33545.C2D30F94@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: Re: PHP and table/view names with "$"
am 29.04.2009 20:56:43 von Christopher Jones
With PHP 5.3 the "nowdocs" syntax will make quoting SQL easier: http://blogs.oracle.com/opal/2008/02/php_53_nowdocs_make_sql _escapi.html
Chris
Mark Casson wrote:
> 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"" wrote in message
> news:007d01c9c404$97d4d1b0$0402a8c0@rincewind...
>> Switch back to double quotes? :-)
>>
>> $stmt = OCIParse($conn, "SELECT * FROM v\$sql WHERE
>> INSTR(SQL_TEXT,'something')>0");
>>
>> ----- Original Message -----
>> From: "Mark Casson"
>> To:
>> 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"" wrote in message
>>> news:89.4E.33545.C2D30F94@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
>>>
>
>
>
--
Email: christopher.jones@oracle.com
Twitter: http://twitter.com/ghrd
Free PHP Book: http://www.oracle.com/technology/tech/php/pdf/underground-ph p-oracle-manual.pdf
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php