Welcome to Webmaster Resources 101
Webmaster resources, forums, articles & tools.
Our Network:
Replacing Text In A MySQL Database Using PHP
[ About This Author :: Request Reprint :: Print Article :: Tell A Friend ]
Replacing Text In A MySQL Database Using PHP
By Ben Sinclair
http://www.webmaster-resources101.com
You may have the word <b>Ben</b> in a lot of your MySQL rows and want to repalce that word with a new word such as <b>Jim</b>.
If you have 10+ of rows with the name <b>Ben</b> in it, it could take a while having to modify each table manually...
Here is a quick and easy way to do it all at once with some simple PHP and MySQL:
<font color="green"><?php
// Connect to your MySQL Database here etc...
// Now with the MySQL Query
mysql_query("update table_name set text=REPLACE(text,'Ben','Jim')");
// Rest of your PHP code...
?></font>
Replace <i>table_name</i> and <i>text</i> with your own database fields and you're all set!
Pretty simple huh?
Enjoy! :)
Discuss this in our Webmaster Forums
Ben Sinclair
http://www.webmaster-resources101.com
Ben Sinclair is the Webmaster of Webmaster Resources 101 and Webmaster Forums 101.
| Go To Top | This article has been read 1196 times. |
[ About This Author :: Request Reprint :: Print Article :: Tell A Friend ]
Best 10 Web Hosting
Leading Web Hosting Industry Directory. Host Search, News and Reviews. Compare the Best Shared Hosting Plans Under $10 a Month. Unix, Windows and Java hosts. Budget, Shared, Reseller and Dedicated providers. Hosts in Canada, Australia and Europe.
Link Exchange
LinkAdage allows webmasters to make money on their websites buying and selling relevant, high pagerank / high traffic text links.
Web Hosting
» Web Hosting India
Software
» MAS 90
Link Popularity
» Reciprocal Link Exchange Directory