variable substitution

This is a discussion on variable substitution within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi All, I have the following query: $query="select CATEGORYID,CATEGORYCODE,ISLEAF from Category C where C.TOPROOTID = {$TOPROOTID} ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-08-2005
Najm Hashmi
 
Posts: n/a
Default variable substitution

Hi All,
I have the following query:
$query="select CATEGORYID,CATEGORYCODE,ISLEAF from Category C where
C.TOPROOTID = {$TOPROOTID} AND C.PTID=0";

The value for $TOPROOTID does not get substituted. The same query works fine
in windows environment. Further more $TOPROOTID is being passed in URL as
following:
localhost/ViewDocument.php?TOPROOTID=1&ROOTLABEL=NT-proBNP%20and%20CHF&CATEG
ORYID=129

The OS is Red Hat9 and RDBMS is Oracle 9i.

The same code works fine in windows but on Linux I am having problem.
Thanks in advance for your help.

Best regards,
Najm



Reply With Quote
  #2 (permalink)  
Old 12-08-2005
ZeldorBlat
 
Posts: n/a
Default Re: variable substitution

Probably not so much a Windows/Linux issue as it is a php.ini issue.
What happens if you throw this right before your build $query :

$TOPROOTID = $_GET['TOPROOTID'];

My guess is that it works. Register globals is probably disabled on
your Linux setup. While you should probably write your scripts to work
without register globals, I realize that isn't always practical.

Reply With Quote
  #3 (permalink)  
Old 12-08-2005
Najm Hashmi
 
Posts: n/a
Default Re: variable substitution

Yes it did work; however, I am facing another issue and will post it later.
Thanks again.
Najm
"ZeldorBlat" <zeldorblat@gmail.com> wrote in message
news:1134009666.346303.256280@g14g2000cwa.googlegr oups.com...
> Probably not so much a Windows/Linux issue as it is a php.ini issue.
> What happens if you throw this right before your build $query :
>
> $TOPROOTID = $_GET['TOPROOTID'];
>
> My guess is that it works. Register globals is probably disabled on
> your Linux setup. While you should probably write your scripts to work
> without register globals, I realize that isn't always practical.
>



Reply With Quote
  #4 (permalink)  
Old 01-16-2006
Jim Michaels
 
Posts: n/a
Default Re: variable substitution

change {$TOPROOTID} to just $TOPROOTID and it will work.
if you want brackets, it should be ${TOPROOTID}

"Najm Hashmi" <najmhashmi@videotron.ca> wrote in message
news:in0mf.5755$FP6.122177@wagner.videotron.net...
> Yes it did work; however, I am facing another issue and will post it
> later.
> Thanks again.
> Najm
> "ZeldorBlat" <zeldorblat@gmail.com> wrote in message
> news:1134009666.346303.256280@g14g2000cwa.googlegr oups.com...
>> Probably not so much a Windows/Linux issue as it is a php.ini issue.
>> What happens if you throw this right before your build $query :
>>
>> $TOPROOTID = $_GET['TOPROOTID'];
>>
>> My guess is that it works. Register globals is probably disabled on
>> your Linux setup. While you should probably write your scripts to work
>> without register globals, I realize that isn't always practical.
>>

>
>



Reply With Quote
  #5 (permalink)  
Old 01-20-2006
Jim Michaels
 
Posts: n/a
Default Re: variable substitution

I think I was wrong. along those lines, I finally found {$variable} in the
manual by searching for the word "substitution". I wasn't in that habit of
using curly braces.
an excerpt from the CHM manual:
To embed the value of an object member variable into a string you simply
write "text {$obj->member} text" while in PHP 3 you had to use something
like "text ".$obj->member." text".

whatever I say is probably irrelevant anyway - I think the register globals
guy got it.

"Jim Michaels" <jmichae3@yahoo.com> wrote in message
news:_P-dnVYXsPwtklHenZ2dnUVZ_sudnZ2d@comcast.com...
> change {$TOPROOTID} to just $TOPROOTID and it will work.
> if you want brackets, it should be ${TOPROOTID}
>
> "Najm Hashmi" <najmhashmi@videotron.ca> wrote in message
> news:in0mf.5755$FP6.122177@wagner.videotron.net...
>> Yes it did work; however, I am facing another issue and will post it
>> later.
>> Thanks again.
>> Najm
>> "ZeldorBlat" <zeldorblat@gmail.com> wrote in message
>> news:1134009666.346303.256280@g14g2000cwa.googlegr oups.com...
>>> Probably not so much a Windows/Linux issue as it is a php.ini issue.
>>> What happens if you throw this right before your build $query :
>>>
>>> $TOPROOTID = $_GET['TOPROOTID'];
>>>
>>> My guess is that it works. Register globals is probably disabled on
>>> your Linux setup. While you should probably write your scripts to work
>>> without register globals, I realize that isn't always practical.
>>>

>>
>>

>
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:10 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0