SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Replacing Text Within a Field

    Hello

    I have an affiliate site. earlier the affiliate link in the database were stored like this:
    http://www.mysite.com/affiliateid.php?id=43

    later I had to do some changes and I had to install an affiliate open source thing. After that the Affiliate Link has to be like this

    http://www.mysite.com/coupon/coupon.php?ref=43

    What i noted is that all the affiliate after the ID number 250 has to be the new link. While older must have the older link.

    here in both the link the NUMBER PART will change and will hold the value of each affiliate. There are about 16000 records in the database and I only want to replace the LINK not the number at the end of the link.

    Please guide

    Thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Code:
    UPDATE daTable
       SET daLink = REPLACE('http://www.example.com/affiliateid.php?id='
                           ,'http://www.example.com/coupon/coupon.php?ref=')
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot r937, really I was thinking that I will get a reply from you and this is you.

    Great !


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •