MySQL conditional insert

Wojtek on conditional, insert, MySQL · · Comments · 1 min read

Sometimes I need to insert some values into the database but only when a certain condition is met. The best example is a newsletter sign up. If someone has already signed up to your newsletter, don’t add his email address again. Of course we can run one query to check if this email address already exists and if not... Read more »

Hot off the workshop vol. 1

Wojtek on CSS, Facebook, HTML, JavaScript, MySQL, PHP · · Comments · 1 min read

Just launched. TK Maxx and Red Nose Day campaign applications. Facebook quiz Fun quiz to find out your perfect Red Nose Day t-shirt. View site Website application Upload you photo with Flash uploader, resize it and pan it around with JavaScript then save your results with PHP. View site... Read more »

MySQL very slow without a reason

Wojtek on database, DNS, MySQL, slow · · Comments · 1 min read

Is your MySQL really slow without actually being too busy? Does your script take very long time to connect to the database? Do you have lots of RAM, strong CPU, just a little traffic and despite that a very long database response time? Are you seeing connections with "unauthenticated user" while running show processlist in MySQL console? mysql&... Read more »

PDO rowCount() not working in PHP 5.1.6

Wojtek on bug, MySQL, PDO, PHP, rowcount · · Comments · 2 min read

The bug If you’re running PHP 5.1.6 and just started using PDO for your database connection, it’s likely you’ll run into quite an annoying bug. Lets test a simple query partly taken from PHP documentation. $calories = 150; $colour = 'red'; $sth = $myPDO->prepare('SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour... Read more »

MySQL PHP PDO error in xampp

Wojtek on MySQL, PDO, PHP, xampp, Windows · · Comments · 1 min read

If your PDO scripts are crashing Apache after installing xampp 1.7 for windows all you need to do is: download this package http://windows.php.net/downloads/releases/php-5.2.11-nts-Win32-VC6-x86.zip" unzip copy libmysql.dll into xampp\apache\bin and xampp\php restart apache All should be good now.... Read more »