Location: PHPKode > scripts > MySQL Database > mysql-database/DatabaseSample.php
<?php

// Define parameters.  Usually done in separate config file.
define('DB_SERVER', 'localhost');
define('DB_NAME', 'root');
define('DB_USER', 'sa');
define('DB_PASSWORD', '');

// Once database is included, a $DataBase object is automatically created.
require_once('MYSQL_DATABASE.php');

$SQL = 'SELECT id,name FROM mytable';
$DataBase->Query($SQL);

// Difference examples to access data
$Rec = $DataBase->GetRecord(3);
echo $Rec->GetField('articleID');

echo $DataBase->GetField(1, 'articleID');

?>
Return current item: MySQL Database