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
Yes it would work and yes there is an easier way--use an update query and the REPLACE() function. Update query: http://www.1keydata.com/sql/sqlupdate.html REPLACE() http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
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
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.
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.
Any ideas of a report creating script that creates professional reports from MySQL database tables? i.e. something like "Crystal Reports" for MySQL database.
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):