|MySQL 5||Tuesday 14th March 2006|
Of course, there is a reason why I upgraded my MySQL installation on my Linux box (see below post). It was due to MySQL 5 being so much better than 4.1.|
I found this out the hard way after getting PHP 5 to work with MySQL 4 and my SQL statements weren't working. I had no idea what I was doing wrong. I write SQL all day at work (albeit, Transact-SQL, but there isn't *that* much difference).
Turns out MySQL 4 doesn't do sub-queries! I can't believe this has never caused me a problem before! This is an example of a sub-query:
SELECT user_name FROM users WHERE user_id IN (
SELECT user_id FROM permissions WHERE permission_description = 'administrator')
This query would get a list of all user's who had the "administrator" role set to them. Naturally this is a ficticious table, I'm not bleating out code that I use in my work! Although the concept is simliar...
|undefined function mysql_connect()... Eeek!||Monday 13th March 2006|
Sometime ago I reinstalled my main PC, which I run Windows on. I do most of my work on here, but recently I haven't had any time to do anything web-related.|
I am currently working on a web-site and I noticed I hadn't finished setting everything up again. Anything else I've been playing around with recently has been on my Linux box which I have Apache 2.2, PHP 5 and MySQL 5.1 running.
Although this time I decided to just use my environment on my PC. After some playing about I noticed I couldn't get any data from a database due to the error:
"undefined function mysql_connect()"
Which threw me a bit, as I can never remember having to configure MySQL to work with PHP. So I went to add the DLL to the PHP.INI (which incidently is in the PHP install dir, and not the WINDOWS dir).
After restarting Apache I got the following error "php_mysql.dll - The specified module could not be found." Which wasn't nice. After a bit of relative/absolute path tinkering in the PHP.INI file the error message was adjusted to:
"php_mysql.dll - The specified procedure could not be found."
Slightly different and a dead giveaway. As it is no longer the module that can't be found but the procedure it indicates that the client library that is being used isn't compatible.
Question is, why would there be an incompatible MySQL module bundled with PHP?
Answer, there isn't. The problem I had was the client library "libmysql.dll" was being used from my MySQL installation, which happens to have the "bin" directory in my PATH (this means I can just type "mysql" into a command prompt to connect locally). I just overwrote this file with the one that came bundled with PHP and all my problems were solved.
I really ought to update my MySQL daemon on this machine, but that's just another thing to add to the list.
|Baa Baa Rainbow Sheep||Tuesday 7th March 2006|
I heard this as a joke many years ago. "Baa, Baa, Black Sheep" being racist.|
This morning I heard that a nursery in Oxford has changed the words to Baa Baa Black sheep to Baa Baa Rainbow Sheep, as the former is racist.
I'd be interested to hear how they came to this conclusion. Answers on the back of a post card.