Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Saturday, 3 May 2008

MySQL and "serial"

In MySQL and PostgreSQL serial can be used when setting up a column in a table. It's the same as writing bigint unsigned not null auto_increment just a lot shorter to write.

Friday, 2 May 2008

Zend and MySQL

Zend currently uses the Pear library to do stuff with DBs. Whereas installing this library may be fine, you might not have access to the server to install more stuff. Instead, follow this article about Adding adapters to Zend which allow it to use PHP. Alternatively, get the latest source files here and put the Php directory within Zend/Db/Adapter/. It works a treat, just remember to set the connection type to php_mysql as opposed to pdo_mysql

None of this is my own work. It all belongs to David Coallier (davidc@agoraproduction.com) and his blog http://blog.agoraproduction.com. Awesome job, thanks.

Thursday, 20 March 2008

MySQL wrapper class

I started writing a wrapper, then I found this PHP MySQL wrapper class prebuilt. It seems very good and the site includes lots of cool example of how to use it. Why bother trying to re-invent the wheel? Well done guys.

Tuesday, 18 March 2008

MySQL basics

The USE database command sets the default database for your stuff. All operations from that point on are applied to that database. When declaring numeric types, a number in brackets called a width specifier which tells MySQL to pad the field when retrieving it. With floats and decimals a precision parameter can also be specified such as FLOAT(7,4). Marking a field with the ZEROFILL attribute will force MySQL to pad the value with zeros. UNSIGNED forces only positive numbers.

The alter can be used in a number of different ways to change name of fields within a table. If you try to convert field types using CHANGE, MySQL may result in errors. Try using IGNORE to get round them.

Use mysqldump to backup and restore databases or tables. Delete stuff from databases and tables using DROP.