PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Nicholas Oliveira   Cyber MySQL   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: a example how to use
Class: Cyber MySQL
Execute MySQL queries using lists of arguments
Author: By
Last change: examples of new class updated
Date: 14 years ago
Size: 912 bytes
 

Contents

Class file image Download
<?

$example
= new SQLConnect();

//Variables

 
$example->getRows(); //return quantity of rows
 
$example->$result; // return result of mysql query (return int)




// basic query

$ex = $example->Query("SELECT field1, field2, field3 FROM table");

?>

<? do{ ?>

 echo $ex['field1'];

<? }while($exe = mysql_fetch_assoc($example->result)); ?>





<? //basic insert

   
$fields = array('field1', 'field2', 'field3');
$content = array("name" , "surname", "age");


if(
$example->SQLInsert("table", $fields, $content){
       
echo
"Sucess";
}else{
   
 echo
"Error on insert";

}

 
?>


<? // UPDATE

if($example->SQLUpdate("table", "field1", "name", "field2", "surname")){

echo
"sucess";

}else{

echo
"error:"

}


?>




<? //DELETE

 
if($example->SQLDelete("table" "field1" "name")){
   
  echo
"sucess";
}else{
 
  echo
"error";
 
}

?>