PHP Classes

File: examples_mysql.php

Recommend this page to a friend!
  Classes of Vinicius Gallafrio   Easy MySQL   examples_mysql.php   Download  
File: examples_mysql.php
Role: Example script
Content type: text/plain
Description: somes examples
Class: Easy MySQL
Author: By
Last change: .
Date: 21 years ago
Size: 1,105 bytes
 

Contents

Class file image Download
<?php
/**
 * Autor: Vinicius Gallafrio - vgallafrio@madeinweb.com.br
 * Date : 15/01/2002
 * http://www.madeinweb.com.br
 *
 * Description: PHP Class for MySQL Connection
 */
 
  // EXAMPLE FOR SELECT
 
include "class.mysql.php";
 
$mysql = New mysql('localhost','root','password','database',0);
 
$mysql->query("SELECT field FROM table"); /* ^-- change to 1 for debug mode */
 
 
if ($mysql->num_rows() > 0) {
          while (
$mysql->movenext()) {
              echo
$mysql->getfield("field");
          }
  }
  
 
// EXAMPLE FOR INSERT
 
include "class.mysql.php";
 
$mysql = New mysql('localhost','root','password','database',0);
 
$mysql->query("INSERT INTO table (field) values ('value')");
 

 
// EXAMPLE FOR UPDATE
 
include "class.mysql.php";
 
$mysql = New mysql('localhost','root','password','database',0);
 
$mysql->query("UPDATE table SET field='newvalue' WHERE fieldID=1");

 
 
// EXAMPLE FOR DELETE
 
include "class.mysql.php";
 
$mysql = New mysql('localhost','root','password','database',0);
 
$mysql->query("DELETE FROM table WHERE fieldID=1");

?>