Forums

PHP

This topic is locked

Writing parameter to page

Posted 27 Jun 2007 13:06:44
1
has voted
27 Jun 2007 13:06:44 Gaz B posted:
Hi all

I've been trying for a while to wrap a parameter so that when the value is displayed from the database it has brackets around it, can anyone help me out. This is the line of code, and the ( ) brackets need to be wrapped around the "volume".

I have tried "" etc. but not winning at all.

$volume = (!empty($rowarticles['volume'])) ? $rowarticles['volume'] : "";

Thank you for any help in advance.

Replies

Replied 27 Jun 2007 15:38:32
27 Jun 2007 15:38:32 Alan C replied:
<pre id=code><font face=courier size=2 id=code> $volume = (!empty($rowarticles['volume'])) ? $rowarticles['volume'] : "";</font id=code></pre id=code>

<pre id=code><font face=courier size=2 id=code> echo '('.$volume.')';</font id=code></pre id=code>

that should do it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 10 Jul 2007 14:30:28
10 Jul 2007 14:30:28 Gaz B replied:
Alan, thanks for this I did try it but it didn't seem to put brackets around the volume.

If I was to display/send my code would anyone be so kind to give me some assistance with this - I am just not winning on this one.

Thanks
Gaz
Replied 10 Jul 2007 17:32:52
10 Jul 2007 17:32:52 Alan C replied:
HI
Sorry - I thought that was what you wanted to do '. . . the () brackets need to be wrapped around the volume . . .'

in php the . operator does string concatonation - it joins the strings together, so that line I put in



<pre id=code><font face=courier size=2 id=code>echo '('.$volume.')'; </font id=code></pre id=code>

works by producing a string that is an opening bracket, then the value of $volume then the closing bracket

Post the code and I'll be happy to look it over

Reply to this topic