find and replace from a database

Discussion in 'MySQL' started by falco85, Jan 3, 2006.

  1. #1
    Hi,
    I have the following problem that I actually don't know how to solve :confused:

    I have a website in PHP of which I have all the pages (they are like 500 pages), and I would like to do some basic SEO on them, say optimizing the title and the meta tags.

    Obviously I reckon the better solution is to find a script or software that can help me to find the existing tags and replace them with the ones I create from my preferred keywords.

    For example, I can build a database on Excel with my keywords manually inserting them, then wanting the script to pick up the correct keywords for the specific pages, and put them in the right place.

    How can I do that? Is there a specific script for this?

    Thank you in advance :)
     
    falco85, Jan 3, 2006 IP
  2. TMan

    TMan Peon

    Messages:
    126
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't quite understand. I assume you have a website made in php which fetches the html from an sql database, and you want to replace the meta tages in the html in this database?

    I don't know if there is a specific script/tool to do this, but if you have full server access you might want to take a look at this. If you don't have full access to the server, don't you have something like phpMyAdmin?

    You must have somehow gotten these pages in the DB at the first place, so you can change them as well I would say...

    If I didn't understand what you tried to say please clarify
     
    TMan, Jan 6, 2006 IP
  3. legend2

    legend2 Well-Known Member

    Messages:
    1,537
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    115
    #3
    for meta tags, why all this hassle? insert them manually into your pages.
     
    legend2, Jan 6, 2006 IP
  4. falco85

    falco85 Peon

    Messages:
    721
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The problem is to manage 500 or more meta tags manually :)
     
    falco85, Jan 7, 2006 IP
  5. yo-yo

    yo-yo Well-Known Member

    Messages:
    4,619
    Likes Received:
    206
    Best Answers:
    0
    Trophy Points:
    185
    #5
    When you call the data from the database (im assuming mysql?) to your page you can do a string replace and insert words that way...

    
    $mydata = $row['mydata'];
    $newdata = str_replace('text to replace', 'replace with this text', $mydata);
    echo $newdata;
    
    PHP:
     
    yo-yo, Jan 15, 2006 IP
  6. AfterHim.com

    AfterHim.com Peon

    Messages:
    1,923
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Could that code be ammended to edit html pages on the server?
     
    AfterHim.com, Jan 31, 2006 IP