9 articles MySQL Page 2 / 2

Quickly update a database field in MySQL by replacing one value with another with find and replace.

This is a MySQL query I find myself using in a bunch of situations when there are multiple users contributing to articles or other means of providing content.  It's usually to replace absolute links like "http://tools.belchamber.us/link-here/" to just "/link-here/", but I found it's useful for many other things.  Recently, I had to import thousands of…

Quickly identify WordPress posts with duplicate content directly from the MySQL database with a single query

This handy query will return all the post IDs from all your WordPress posts that are exact duplicates.  I usually run this query in a loop and then will delete the newest post duplicate.  This problem usually comes from multiple users importing content into the new WordPress site or importing content from Joomla into WordPress…

Getting that strange “black diamond” and other weird symbol characters that return text from a database?

It's inevitable, right when you thought your website was going smoothly, suddenly those strange symbols like the "black diamond question marks" start popping up. I sometimes have to clean variables returned from form input and other external text with PHP's "iconv" function, but if the data is coming from a database and showing up funky,…

Connecting to PDO as an object

Moving from procedural with mysql_connect, etc to PDO objects should be an easy transition.  It's so much faster and reliable, too.  The "mysql" library in PHP will soon be deprecated, so you hold-outs won't have a choice.  It's actually less code to write and get whole queries into resulting arrays much faster.  Trust me! Here's…
  • Page 2 of 2
  • 1
  • 2