· Martin's Expiry Checker v3 Blog ·

M.E.Bush > Misc. > Expiry Checker v3 Blog > 16-Aug-2006

Using MySQL instead

I wondered about going for a completely new solution using MySQL. I'm embarrassed to admit that although I've read (and even hacked) a few simple php scripts that have incorporated calls to a MySQL database, I've never actually created a MySQL database table or written a script that interacts with a MySQL database from scratch. There's a first time for everything, and this might be it for me and MySQL!

Actually it wouldn't be a completely new solution, because the algorithm is essentially the same as before, and I would need to reuse some of my existing php code, and - come to think of it - I'll still be stuck with the problem of how to verify that a supposedly expired web page is indeed still expired!

I prepared the MySQL table anyway, although still not certain as I write this whether to switch to MySQL or perservere with xml files...

% mysql -p bushm
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 922925 to server version: 3.23.32

Type 'help;' or '\h' for help. Type '\c' to clear the buffer

mysql> CREATE TABLE expirycheckertable (
    -> id int primary key auto_increment,
    -> url varchar(255),
    -> expirydate varchar(255),
    -> owner varchar(255),
    -> message varchar(255) 
    -> );
Query OK, 0 rows affected (0.08 sec)

mysql> SHOW TABLES;
+--------------------+
| Tables_in_bushm    |
+--------------------+
| expirycheckertable |
+--------------------+
1 row in set (0.00 sec)

mysql> DESCRIBE expirycheckertable;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | int(11)      |      | PRI | NULL    | auto_increment |
| url        | varchar(255) | YES  |     | NULL    |                |
| expirydate | varchar(255) | YES  |     | NULL    |                |
| owner      | varchar(255) | YES  |     | NULL    |                |
| message    | varchar(255) | YES  |     | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

mysql>