another newbie question! :)

This is a discussion on another newbie question! :) within the PHP Language forums, part of the PHP Programming Forums category; Hi there again.. i also was wondering about replacing variables in a script. say i have something that calls up: ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-11-2004
Mikey P
 
Posts: n/a
Default another newbie question! :)

Hi there again.. i also was wondering about replacing variables in a
script.

say i have something that calls up:

1558 chestnut ave.

how would i change the spaces to + like:

1558+chestnut+ave


i would be calling it up from a sql database. then posting it with an
echo function like:

echo('<font size="2" face="Arial, Helvetica, sans-serif"><b>' .
$row['company'] . '</b>' . '<br>' . $row['address'] . '<br>'
..$row['city'] . ' ' . $row['state'] . ', ' . $row['zip'] . '<br>' .
'<a href="http://' . $row['website'] . '">' . $row['website'] .
'</a>' . '<br>' . $row['description'] . '</font></li></p>');

and the address would be the one i need changed.

Thanks so much again for the direction!
Reply With Quote
  #2 (permalink)  
Old 08-11-2004
Logical
 
Posts: n/a
Default Re: another newbie question! :)

Mikey P wrote:

> Hi there again.. i also was wondering about replacing variables in a
> script.
>
> say i have something that calls up:
>
> 1558 chestnut ave.
>
> how would i change the spaces to + like:
>
> 1558+chestnut+ave
>
>
> i would be calling it up from a sql database. then posting it with an
> echo function like:
>
> echo('<font size="2" face="Arial, Helvetica, sans-serif"><b>' .
> $row['company'] . '</b>' . '<br>' . $row['address'] . '<br>'
> .$row['city'] . ' ' . $row['state'] . ', ' . $row['zip'] . '<br>' .
> '<a href="http://' . $row['website'] . '">' . $row['website'] .
> '</a>' . '<br>' . $row['description'] . '</font></li></p>');
>
> and the address would be the one i need changed.
>
> Thanks so much again for the direction!


At first glance str_replace() would be the most efficient manner,
however you may also be after urlencode() depending what else you plan
to do with the string.

--
Logical
Reply With Quote
  #3 (permalink)  
Old 08-11-2004
Aphrael
 
Posts: n/a
Default Re: another newbie question! :)

Mikey P wrote:
> Hi there again.. i also was wondering about replacing variables in a
> script.
>
> say i have something that calls up:
>
> 1558 chestnut ave.
>
> how would i change the spaces to + like:
>
> 1558+chestnut+ave


http://ch.php.net/manual/en/function.str-replace.php ?

Aphrael...
--
"La demande mondiale d’ordinateurs n’excédera pas cinq machines."
(Thomas Watson, Fondateur d'IBM, 1945)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:53 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0