Most people validate e-mail addresses in a normal programming language, such as PHP and that is a very good idea when you process user input and such, however sometimes you want to validate data already entered in a database.
Take this example: you have a comments table where each person can enter an e-mail address, but since it’s an optional field you don’t even validate the input. However when you need to send a newsletter you don’t want to process all fields and validate one by one, you want to use a single query and just get all e-mail addresses (eventually by adding additional rules as well), so here’s how you can do it in MySQL:
Sure, you can optimize the query, but it’s a simple regular expression which .. well, in most cases is good enough.
Firefox 3 sure is a nice version of the popular browser, and the statistics confirm it: 8,000,000 downloads in first 24 hours.
However, with new versions come incompatibilities with old extensions, small glitches and bugs (actually I didn’t see any of the last two). But the thing that irked me most was the fact that I could not use my MinimizeToTray Extension. Although the new version is much faster to load, it is much more convenient to keep it in the tray bar and save all your tabs.
The good news is that an update for it was released by Fentzy and hopefully it will get updated on the official website as well soon, but for now, here’s where you can get it from:
Here’s a quick post about an interesting website I made today: Whois information for any domain
Just as the name says, it’s a quick and easy way to find WHOIS information for any domain. You never know when it comes in handy.
As you might know it’s quite easy to make multiple INSERTs in a single query, like this:
INSERT INTO mytable
('1', 'Lord of the Rings'),
('2', 'Harry Potter');
However, for some strange reason you can’t do multiple changes to a table in a single UPDATE query like this:
SET (title='Great Expectations' WHERE id='1'),
(title='War and Peace' WHERE id='2');
Continue reading How to make multiple updates using a single query in MySQL