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} ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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. > |
|
|||
|
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. >> > > |
|
|||
|
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. >>> >> >> > > |
![]() |
| Thread Tools | |
| Display Modes | |
|
|