Looking for some MYSQL advice

Discussion in 'MySQL' started by Buckyuk, Oct 12, 2009.

  1. #1
    Hi,
    Im looking for some advice on editing my database, the problem that ive got is that i want to make all links that are present in my articles to nofollow. only way i can think of which wont take days to do, is to expert my MYSQL database and open it in notepad... Then do find and replace to replaced every occasion of href= to rel="nofollow" href=

    This will obviously change every link to nofollow, then i planned to save it and import it again.
    I tried it but it came up duplicate entry, obviously because i hadnt deleted the original database (im assuming).

    Would this work? is there an easier way to do this?

    thanks alot in advance
     
    Buckyuk, Oct 12, 2009 IP
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    plog, Oct 12, 2009 IP
  3. Buckyuk

    Buckyuk Active Member

    Messages:
    381
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Im not sure if im doing it right, but ive tried it, and got this error report....

    There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

    ERROR: Unknown Punctuation String @ 14
    STR: =,
    SQL: REPLACE (href=, href=, rel="nofollow")


    SQL query:

    REPLACE (href=, href=, rel="nofollow")

    MySQL said: Documentation
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(href=, href=, rel="nofollow")' at line 1
     
    Buckyuk, Oct 13, 2009 IP
  4. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #4
    My first guess is it has to do with the single and double quotes in your query--you probably need to escape them. If you could post the entire SQL of your query I can give more specific advice.
     
    plog, Oct 13, 2009 IP
  5. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #5
    Use the following replace syntax
    REPLACE (column_to_update, 'href=', 'rel="nofollow" href=')
    Code (markup):
    For further assistance, post your query.

    Make sure you backup your database before executing this query.
     
    mwasif, Oct 13, 2009 IP
  6. phones2me

    phones2me Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    use update query
     
    phones2me, Oct 14, 2009 IP
  7. digiartist

    digiartist Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Any ideas of a report creating script that creates professional reports from MySQL database tables? i.e. something like "Crystal Reports" for MySQL database.
     
    digiartist, Oct 27, 2009 IP
  8. heavydev

    heavydev Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    digiartist please start your own thread :)
     
    heavydev, Oct 27, 2009 IP
  9. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #9
    Buckyuk,

    In all these trial and error you might land up having multiple rel="nofollow", hence i suggest to execute following two queries which are derived from little modification to mwasif's queries.

    
    UPDATE tbl_name SET column_to_update = REPLACE (column_to_update, 'rel="nofollow"', '');
    UPDATE tbl_name SET column_to_update = REPLACE (column_to_update, 'href=', 'rel="nofollow" href=');
    
    Code (markup):
     
    mastermunj, Oct 28, 2009 IP