For some reason i had duplicate entries in my WP database. The ID field in wp_users table was tempered with and was changed to Non Auto-Increment to insert records on the will. I deleted all ID=null records manually and then tried to change it to AUTO INCREMENT but it came up with Duplicate Entry error and then i found that it had duplicated/multiple entries with same IDs as well. Here’s the remedy i had to apply in order to delete those duplicate entries and change ID field to AUTO INCREMENT once again. Continue reading
While working on a web links directory i wanted to update categories table’s num_listings column with the count of listings under each category. The category id was stored something like this in listings table: Continue reading
Just a few notes on joining a MySQL table to itself to get unique combination of data stored in its fields.
Suppose we have a MySQL table named `keywords` having fields `word1`, `word2` and `word3`. Once we have got a few records inserted into this table we would want to show all possible combination of keywords stored in those fields. For example, a select query returns a following set of data: Continue reading
Having WAMP installed when i try to type mysql in my windows command prompt it would give me the following error: Continue reading
Here is a quick way to calculate the difference between two mysql dates in number of seconds. In my case, i required to fetch all entries for which the difference between current time stamp and date in a table field would be less than 5 minutes. Continue reading