From: Sue Hanen <shanen@silverlink.net>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Trying to concatenate using a string variable and text
Date: Fri, 26 Feb 1999 19:02:44 -0800
Message-ID: <01BE61BB.4892A020@silver170-44.silverlink.net> (raw)
In the simplest form I need to built a query using a variable concatenated with some text. Something like this:
$query = "select * from table where fieldname $oper '$key[0]' "
And then I'd like to concatenate that $query with the following in a while loop:
$query = $query || " $logic fieldname $oper '$key[$i]' "
and when the while loop is done concatenate one last time with the following:
$query = $query || "order by fieldname"
$oper has been set to the regular expression characters ~ or ~* for case sensitivity
$logic has been set to OR
This code worked under PHP2 but I can't seem to get it to work under PHP3. I thought that all I would have to do is replace the plus sign (which was the concatenation character in PHP2 with the || which is the concatenation character in PHP3. I am new to PHP and any help I can get is greatly appreciated.
Sue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: shanen@silverlink.net
Subject: Re: Trying to concatenate using a string variable and text
In-Reply-To: <01BE61BB.4892A020@silver170-44.silverlink.net>
References: <01BE61BB.4892A020@silver170-44.silverlink.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox