SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    find/replace text in database field?

    I have a form field in one of my tables and need to replace some text within it for all the entries.

    Example of what is in my form field

    <FORM METHOD=POST ACTION="http://www.?????">
    <INPUT TYPE=HIDDEN NAME=??? VALUE="???">
    <INPUT TYPE=HIDDEN NAME=??? VALUE="???">
    <INPUT TYPE=HIDDEN NAME=??? VALUE="???">
    </FORM>

    What i want to do is replace the http://www.????? with something else. Is there a find/replace feature to run through my form field in my table and only replace the selected part i want changed with something else?

    Thanks for any help.
    Last edited by bigjohn5; Jun 26, 2002 at 09:57.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    While i figured it out. So if anyone wants to know how to replace a part of something in a field here it is.

    UPDATE table name SET field name = REPLACE (field name , 'part of field you want replaced ', 'what you want inserted in it's place ');

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bigjohn5,

    That update query looks really weird to me, but I'm sure it works for you try this and see if it's a little easier


    mysql_query ("Update table
    set field='what you want here'
    ");

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The thing is i only want part of the field replaced, not the whole field. So the query above would replace the whole field and not just a selected portion of it like i need. I have no clue if the way i did it is the best way, but it worked. If anyone has a better way or sees a reason why the way i did it could screw things up please let me know.

    Thanks

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to a more appropriate forum - not a PHP question!

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature


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
  •