PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Ray   IdealMySQL Class   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Example file
Class: IdealMySQL Class
MySQL database access wrapper
Author: By
Last change:
Date: 17 years ago
Size: 820 bytes
 

Contents

Class file image Download
<html>
    <head>
        <title>Test IdealMySQL Class</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>
<body>
<?php
// Include the IdealMySQL Class
include ("./IdealMySQL.class.php");

// Create a new object
$dbtest = new IdealMySQL("database","localhost","dbuser","dbpassword");

// Check variable to make sure it does not have any invalid characters
// the only valid characters are: a-zA-Z0-9_-
$dbtest->checkvar("a$");

// Insert some information into the database.
$dbtest->MySQLQuery("INSERT INTO database(name,email,text) VALUES('name','email@email.com','This stuff')");

// Selet some information from the database
$stuff = $dbtest->MySQLQuery("SELECT * FROM database");
while(
$row = mysql_fetch_array($stuff)) {
    echo
$row['id']."<br>";
}
?>
</body>
</html>