Posted by Matt on 27th November 2006
If you’re just trying to find a replace a string in a MySQL table, you don’t need to write a script to do it. You can simply use the following syntax with MySQL (e.g. phpMyAdmin, MySQL shell access)
UPDATE TABLENAME SET COLUMNNAME = replace(COLUMNNAME,”FINDWHAT”,”REPLACEWITHWHAT”);Note that this method is case-sensitive. This is a great timesaver over doing it with a scripting language such as PHP. With PHP, you’d have to write a script to select the row, do the replacement, and update the table.
Posted in Web Development, MySQL | No Comments »
Posted by Matt on 27th November 2006
Recently I was working on a site having some DNS issues. I could only view the site at the old DNS address and did not want to wait and could not access it by IP address due to the circumstances. I had to view the site in order to complete the project. Because the database was large installing on a local system to test was out of the question due to time constraints.
Here’s what I ended up doing to view that site at the url before the DNS had propagated.
In Windows XP, I went to C:\windows\system32\drivers\etc\hosts
I opened the host file, typed in the URL and IP address in the format of the localhost example given:
127.0.0.1 localhost
Saved the file, closed my browser window, opened a new browser window and went to the URL. It worked.
When I was done I removed the entry and it went back to the old DNS again.
Great time saving tip for working with a site before the DNS has propagated.
Posted in Windows XP, Web Development | No Comments »