tips and tricks for web developers & designers, and system & network admins

not-sexy.com

How to add a column to a mysql 5 table only if the column does not already exist

September 16, 2008 | work, mysql | 5:02 pm | Comments [0] |

The situation is this: You are running a database update script, and you need to add an additional field to a table in a way such that the script will not fail if the column already exists (from a previous update etc.). Most people would simply use a php script to get the layout of the table and then only execute the ALTER TABLE command if the column does not already exist, but sometimes we are bound by scripting restrictions, so here is the SQL code to do it:
(more…)


FTP Problems - netout: Broken pipe 550 can’t access file.

September 1, 2008 | work, windows, backup, ftp | 9:17 am | Comments [0] |

Over the weekend, one of my backup scripts started erroring out while sending the backups offsite to an FTP server. The error message was:

200 Port command successful
150 Opening data channel for file transfer.
netout: Broken pipe
550 can't access file.

(more…)