Mysql explained

Mysql is a database for storing any kind of information and it is usualy used with php to input and read the data.

The data can be used in tables, calculations, mailing lists etc.

You need to setup users to connect to the database, the database and tables within the database ( the tables contain the data). Most of this is easily done using a program called phpMyAdmin.

The basic code to produce the Mysql examples is :-


//Mysql settings - The host is normaly localhost unless the database is on a different server.
$database 'database name';
$username'your username';
$password'your password';

// Connect to the database
$connect mysql_connect("$host","$username","$password");

if (!
$connect) die ("Could not connect MySQL");

// Select the database
mysql_select_db($database,$connect) or die ("Could not open database");

// The "query" to get the information out of the database and build the array
$result=mysql_query("SELECT * FROM database_table_name ORDER BY id") or die (mysql_error());

// Close the connection to the database

// Start the table to display the results
echo "<table width='100%' border='0'  bordercolor='#000000' cellpadding='4' cellspacing='0'>\n";

// Loop through the data creating the rows in the table
while ($row mysql_fetch_array($result)) {

// Display the results
echo "<tr>\n<td align='center'>".$row['id']."</td><td align='center'>".$row['container']."</td><td>".$row['description']."</td><td align='center'>".$row['quntity']."</td><td align='center'>£".$row['guide_price']."</td>\n</tr>\n";

// End the table
echo "</table>";