Notes on the Examples

The following examples are based on this simple table:

CREATE TABLE user 
(
  id            MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, 
  login         CHAR (16) NOT NULL, 
  password      CHAR (16) NOT NULL, 
  PRIMARY KEY (id)); 
) 

Many of the examples use this include file:

<?php 
// filename 'mysql_connect.inc.php' 
// Connect to a MySQL server and select a database 

$host = 'localhost'; 
$user = ''; 
$pass = ''; 

$db = 'some_db'; 

$mysql_link = mysql_pconnect ($host, $user, $pass) 
   or die ("Could not connect to the MySQL server 
      located at '$host' as user '$user'."); 

mysql_select_db ($db, $mysql_link) 
   or die ("Could not set database '$db' as the active database."); 
?> 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.