Saturday, February 9th, 2013

To Index or not to Index

Some indexes make the database faster while others make it slower. It all depends on how frequently the index is used and how often the table is updated. To Index or not to Index

Saturday, December 15th, 2012

Defining Tables

While using phpmyadmin to manually create the database tables for your script may initially seem like a good idea there are many reasons why writing a separate script to define your tables is a far better idea. Defining Tables

Thursday, December 13th, 2012

Primary Keys

In applications that reflect things that exist in the real world there are seldom situations where there isn’t something that has a unique value that can be used as the primary key for a table in your database. Despite this many people who know nothing about database design always implement an autoincrement primary key which [...]

Saturday, December 1st, 2012

Float or Numeric

Using the float data type in mySQL just because that’s the data type you used in your script or program is not usually a good idea. While float does have its uses in mySQL, the numeric (or decimal) data type is usually a far better alternative. Float or Numeric

Friday, November 30th, 2012

Receipt Numbering using Autoincrement

In almost all cases you can resolve duplicate record problems in your database most easily by getting rid of any associated autoincrement primary key. Here we look at one of the rare instances where an autoincrement primary key actually makes the processing simpler – generating sequential invoice or receipt numbers. Receipt Numbering using Autoincrement

Saturday, October 13th, 2012

mySQL enum Fields

One field type that mySQL supports that other SQL databases don’t is the enum. While some other SQL databases have an equivalent field type that they call something else, there are things other than cross database support that need to be considered. mySQL enum Fields

Sunday, October 7th, 2012

mysql and mysqli Queries

It isn’t only in how you connect to the database that mysqli_ differs from mysql_ as mysqli_ offers much more. One of the bigger benefits to mysqli_ is its ability to use prepare statements to completely separate the data from the query (something only possible with mysql_ if you have PDO installed). mysql and mysqli [...]

Saturday, October 6th, 2012

mysql_ and mysqli_

There are some significant differences in the way that these two alternative database interfaces work. We can begin our look at how the two differ from one another by looking at the code needed to connect to a database. mysql_ and mysqli_

Tuesday, September 25th, 2012

Select and Union

The UNION command can be used in mySQL when you need to take the results of multiple queries and combine them together. Select and Union

Tuesday, January 17th, 2012

Gaps in Pseudokeys

A pseudo key in a database is a field that you have added to the data specifically to serve as a unique key so as to allow the data to be easily referenced from other tables. You should only use one where the natural key for the data is too long to make it suitable [...]

Sunday, December 25th, 2011

Creating a Database Using cPanel

To use most server side scripts you need a database. How you actually set up your database depends on what hosting you have. If your host only provides you with one database they may have set it up for you already. If you have to set up your own database and your hosting uses cPanel [...]

Sunday, November 6th, 2011

Changing mySQL Passwords

While changing a mySQL password appears easier to do with Plesk than it does with cPanel (since Plesk provides a specific option to do it) you can in fact change the password just as easily regardless of the control panel you are using. Here’s a way to do it that doesn’t depend on the control [...]