Login   Register  
PHP Classes
elePHPant
Icontem

File: example_1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Sinan Özel  >  MySQL_Control  >  example_1.php  >  Download  
File: example_1.php
Role: Example script
Content type: text/plain
Description: Simple Example
Class: MySQL_Control
Simplified MySQL Database Control
Author: By
Last change: Small correction.
Date: 2002-09-01 17:12
Size: 632 bytes
 

Contents

Class file image Download
<?

include("mysql.class.php");

$db = new MYSQL;
$db->Connect("test","webuser","2vd46r1s");

$fields["username"] = "CHAR(255) NOT NULL";
$fields["password"] = "CHAR(255)";
$fields["last_access"] = "TIMESTAMP";

$db->CreateTable("users"$fields"username""PRIMARY KEY");

$record["username"] = "sinan";
$record["password"] = crypt("sinanpass"); // Maybe I used the wrong function here.


$db->Insert("users"$record);

$users $db->SelectSet("users");

foreach( 
$users as $user ){
    echo 
$user["username"].", accessed last at".date("m / d / Y, H:m:i"$user["lastaccess"]);
}

$db->Disconnect(); 

?>