You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by BAO RuiXian <ba...@atbusiness.com> on 2002/09/02 23:02:21 UTC

Re: [users@httpd] PHP CODE DRIVING ME NUTS

Don't understand why there are two respondents telling using the single quotes
to quote $bar, which I understand not to be resoluted in Perl. I would suggest
simply the following:

    $SQL = "SELECT * FROM review WHERE bar_name = $bar";


Best

Bao

Matthew Daubenspeck wrote:

> On Mon, Sep 02, 2002 at 03:18:16PM -0600, Grant Cooper wrote:
> > $bar = "The Beverage";
> > $SQL = "$SELECT * FROM review WHERE bar_name=$bar";
> >
> > When sql executes the statement is kills off the "The" part.
>
> $SQL = "SELECT * FROM review WHERE bar_name = '$bar'";
>

--
BAO RuiXian, PROGRAMMER, Project Consulting Team, Software Services Group
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180 Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311 6601
Web: www.atbusiness.com, Email: {bao.ruixian, ruixian.bao}@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PHP CODE DRIVING ME NUTS

Posted by Matthew Daubenspeck <ma...@oddprocess.org>.
On Mon, Sep 02, 2002 at 11:29:28PM +0100, Chris Taylor wrote:
> 
> This *is* PHP, in case you're unclear :)
> 
> I've been doing it for a while, and I've never had a problem using '
> without escaping in PHP, it's always worked fine for me.

Agreed here. If you so wish, you can replace the ' with \"

But either will work in this situation.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PHP CODE DRIVING ME NUTS

Posted by BAO RuiXian <ba...@atbusiness.com>.
Okay, you got me. I know nothing about PHP except that with GREAT patience I
read some instruction for PHP some time ago. But, I have to say PHP is not
NICE at least in this aspect. You see, it even can not encapsulate an already
replaced value with space:)

Best

Bao

Chris Taylor wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> This *is* PHP, in case you're unclear :)
>
> I've been doing it for a while, and I've never had a problem using '
> without escaping in PHP, it's always worked fine for me.
>
> Chris Taylor - The guy with the PS2 WebServer
> Email: chris@x-bb.org - PGP: http://www.x-bb.org/chris.asc
>
> - ----- Original Message -----
> From: "BAO RuiXian" <ba...@atbusiness.com>
> To: <us...@httpd.apache.org>
> Sent: Monday, September 02, 2002 10:27 PM
> Subject: Re: [users@httpd] PHP CODE DRIVING ME NUTS
>
> > Then maybe the following is suitable:
> >
> >     $SQL = "SELECT * FROM review WHERE bar_name = \'$bar\'";
> >
> > otherwise, I am not sure $bar can be still replaced with the value.
> >
> > Best
> >
> > Bao
> >
> > Chris Taylor wrote:
> >
> > > -----BEGIN PGP SIGNED MESSAGE-----
> > > Hash: SHA1
> > >

--
BAO RuiXian, PROGRAMMER, Project Consulting Team, Software Services Group
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180 Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311 6601
Web: www.atbusiness.com, Email: {bao.ruixian, ruixian.bao}@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PHP CODE DRIVING ME NUTS

Posted by Chris Taylor <ch...@x-bb.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This *is* PHP, in case you're unclear :)

I've been doing it for a while, and I've never had a problem using '
without escaping in PHP, it's always worked fine for me.

Chris Taylor - The guy with the PS2 WebServer
Email: chris@x-bb.org - PGP: http://www.x-bb.org/chris.asc

- ----- Original Message ----- 
From: "BAO RuiXian" <ba...@atbusiness.com>
To: <us...@httpd.apache.org>
Sent: Monday, September 02, 2002 10:27 PM
Subject: Re: [users@httpd] PHP CODE DRIVING ME NUTS


> Then maybe the following is suitable:
> 
>     $SQL = "SELECT * FROM review WHERE bar_name = \'$bar\'";
> 
> otherwise, I am not sure $bar can be still replaced with the value.
> 
> Best
> 
> Bao
> 
> Chris Taylor wrote:
> 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > You need to quote the $bar with ' because if it involves a space,
> > the replacement with it's value will make the SQL statement
> > invalid, hence the SQL error.
> >
> > Chris Taylor - The guy with the PS2 WebServer
> > Email: chris@x-bb.org - PGP: http://www.x-bb.org/chris.asc
> >
> > - ----- Original Message -----
> > From: "BAO RuiXian" <ba...@atbusiness.com>
> > To: <us...@httpd.apache.org>
> > Sent: Monday, September 02, 2002 10:02 PM
> >
> 
> --
> BAO RuiXian, PROGRAMMER, Project Consulting Team, Software Services
> Group AtBusiness Communications Corporation, Kaapeliaukio 1,
> FIN-00180 Helsinki Telephone +358-9-2311 6674, Mobile +358-50-329
> 6275, Fax +358-9-2311 6601 Web: www.atbusiness.com, Email:
> {bao.ruixian, ruixian.bao}@atbusiness.com  
> 
> 
> 
> --------------------------------------------------------------------
> - The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPXPmRSqf8lmE2RZkEQL/dACglkUV7irGipU82gVtl/+TX8RiXBQAoKuN
mATMuw2N4GQzBmaViogPTA/x
=9M05
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PHP CODE DRIVING ME NUTS

Posted by BAO RuiXian <ba...@atbusiness.com>.
Then maybe the following is suitable:

    $SQL = "SELECT * FROM review WHERE bar_name = \'$bar\'";

otherwise, I am not sure $bar can be still replaced with the value.

Best

Bao

Chris Taylor wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> You need to quote the $bar with ' because if it involves a space, the
> replacement with it's value will make the SQL statement invalid,
> hence the SQL error.
>
> Chris Taylor - The guy with the PS2 WebServer
> Email: chris@x-bb.org - PGP: http://www.x-bb.org/chris.asc
>
> - ----- Original Message -----
> From: "BAO RuiXian" <ba...@atbusiness.com>
> To: <us...@httpd.apache.org>
> Sent: Monday, September 02, 2002 10:02 PM
>

--
BAO RuiXian, PROGRAMMER, Project Consulting Team, Software Services Group
AtBusiness Communications Corporation, Kaapeliaukio 1, FIN-00180 Helsinki
Telephone +358-9-2311 6674, Mobile +358-50-329 6275, Fax +358-9-2311 6601
Web: www.atbusiness.com, Email: {bao.ruixian, ruixian.bao}@atbusiness.com



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] PHP CODE DRIVING ME NUTS

Posted by Chris Taylor <ch...@x-bb.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You need to quote the $bar with ' because if it involves a space, the
replacement with it's value will make the SQL statement invalid,
hence the SQL error.

Chris Taylor - The guy with the PS2 WebServer
Email: chris@x-bb.org - PGP: http://www.x-bb.org/chris.asc

- ----- Original Message ----- 
From: "BAO RuiXian" <ba...@atbusiness.com>
To: <us...@httpd.apache.org>
Sent: Monday, September 02, 2002 10:02 PM
Subject: Re: [users@httpd] PHP CODE DRIVING ME NUTS


> Don't understand why there are two respondents telling using the
> single quotes to quote $bar, which I understand not to be resoluted
> in Perl. I would suggest simply the following:
> 
>     $SQL = "SELECT * FROM review WHERE bar_name = $bar";
> 
> 
> Best
> 
> Bao
> 
> Matthew Daubenspeck wrote:
> 
> > On Mon, Sep 02, 2002 at 03:18:16PM -0600, Grant Cooper wrote:
> > > $bar = "The Beverage";
> > > $SQL = "$SELECT * FROM review WHERE bar_name=$bar";
> > >
> > > When sql executes the statement is kills off the "The" part.
> >
> > $SQL = "SELECT * FROM review WHERE bar_name = '$bar'";
> >
> 
> --
> BAO RuiXian, PROGRAMMER, Project Consulting Team, Software Services
> Group AtBusiness Communications Corporation, Kaapeliaukio 1,
> FIN-00180 Helsinki Telephone +358-9-2311 6674, Mobile +358-50-329
> 6275, Fax +358-9-2311 6601 Web: www.atbusiness.com, Email:
> {bao.ruixian, ruixian.bao}@atbusiness.com  
> 
> 
> 
> --------------------------------------------------------------------
> - The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPXPiSiqf8lmE2RZkEQKP1gCfWecxqbv88fTpq4M2HIGyyyR72WkAnRsH
TzbmTcnp70doEWSaS9YjoVwA
=OPUY
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org