pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTrying to concatenate using a string variable and text
2+ messages / 2 participants
[nested] [flat]
* Trying to concatenate using a string variable and text
@ 1999-02-27 03:02 Sue Hanen <shanen@silverlink.net>
0 siblings, 0 replies; 2+ messages in thread
From: Sue Hanen @ 1999-02-27 03:02 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Trying to concatenate using a string variable and text
@ 1999-02-27 15:00 Mauricio Carvalho de Oliveira <carvalho@dt.fee.unicamp.br>
0 siblings, 0 replies; 2+ messages in thread
From: Mauricio Carvalho de Oliveira @ 1999-02-27 15:00 UTC (permalink / raw)
To: pgsql-sql@hub.org; shanen@silverlink.net
> ... 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.
The concatenation operator in PHP3 is "." Try
$a = "Hello";
$b = "World";
$HelloWorld = $a . ", " . $b . "!";
--
Mauricio C. de Oliveira
mailto:carvalho@dt.fee.unicamp.br
http://www.dt.fee.unicamp.br/~carvalho
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-02-27 15:00 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-27 03:02 Trying to concatenate using a string variable and text Sue Hanen <shanen@silverlink.net>
1999-02-27 15:00 Re: Trying to concatenate using a string variable and text Mauricio Carvalho de Oliveira <carvalho@dt.fee.unicamp.br>
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