PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mathieu Dumoulin  >  mysql_connection  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: mysql_connection
Wrapper for several MySQL connection information
Author: By
Last change: Did a typo while writting the new example file, i used the vb style method access "." instead of the c style method access "->".
Date: 13 years ago
Size: 575 bytes
 

Contents

Class file image Download
<?php
include("class.mysql.connection.php");

$mysql_server = new mysql_connection("localhost", "user", "pass", "mydb");
$mysql_server->open();
$result = $mysql_server->send_result_sql("SELECT * FROM thattable", 0);

//This checkup takes into account that there are no error column in the
//table queried.
if(isset($result[error])){
 
//There was an error
 
Echo "An error occured<br>" . $result[error] . "<br>" . $result[sql];
}else{
 
//There are results
 
while($row = mysql_fetch_array($result)){
   
//Echo my data
 
}
}

$mysql_server->close();

?>