Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Jan 2003
    Posts
    11
    Member #
    524
    Thanks all for the help on the last one.
    My problem now is that i need to take a string returned from my database.(its an address) and insert either a "+" or a "%20" into the spaces in the address. So the string "123 N. State St." will be passed in a link as"
    123+N.+State+St." Got any ideas? Thanks

    I am trying to do something like this to link dynamically to mapquest:
    /*echo("<br><a href=http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&address=".$row['bar_address']."&city=Chicago&state=IL&zipcode=&homesubmit=Get+M ap>MAP</a>");*/
    but my address has spaces so mapquest only recieves the part of the address before the first space.

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Try this:
    Code:
    SELECT REPLACE(url, " ", "+") FROM yourtable;
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Junior Member
    Join Date
    Jan 2003
    Posts
    11
    Member #
    524
    I figured it out. Thanks
    I probably didnt explain well exactly what i was doing but i ended up using the PHP function str_replace(). like this if anyones wondering:
    $addrstr=str_replace(" ","%20",$row["bar_address"]);

    Thanks

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    It's still probably a good idea (IMO at least) to use MySQL's REPLACE function; a general rule that I've found is don't do something in PHP when MySQL can do it just as easily.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    Senior Member
    Join Date
    Mar 2002
    Location
    Alabama sans the damn flag
    Posts
    263
    Member #
    38
    ummmm...maybe. Depends on what your doing. If (as is the case here) it is a common SQL command support by the SQL database community, then you are absolutely right.

    Who know what will happen to PHP? SQL will be around forever ... kinda like Fortran and COBOL.

    However, if it is an extension that is not supported by the ANSI committee, then you are better off with the PHP,ASP or whatever flavor of the month you are using. If the committee takes it into their little brains to change or delete the function, the next iteration won't work at all, but your language specific function probably will.
    DerFarm
    I talk to squirrels.
    Squirrels Answer.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:29 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com