PHP Classes
elePHPant
Icontem

File: db_simple_operations

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Md. Aminul Islam  >  Simple Operations  >  db_simple_operations  >  Download  
File: db_simple_operations
Role: Example script
Content type: text/plain
Description: Example For this Class
Class: Simple Operations
Build SQL queries from parameters
Author: By
Last change:
Date: 9 years ago
Size: 1,915 bytes
 

Contents

Class file image Download
<?
   
//First Create A Database Named be_perfect and Run the SQL String in DatabaseClsConnection.txt File.
   
   
   
include "ClsConnection.cls.php";
   
//For Automatic Connection According to Class Variables.
   
$ObjConnection=new ClsConnection();
   
   
//For User Defined Connection
   
$HostName="mycompany.com";
   
$UserName="aminul";
   
$Password="aminulsumon@yahoo.com";
   
$DatabaseName="be_perfect";
   
$ObjConnection->UserDefineConnection($HostName,$UserName,$Password,$DatabaseName);
   
   
//Check "Student" Table Existance (Return True if Exists otherwise False).
   
$DatabaseTableName="Student";
   
$ObjConnection->DataBaseTableExists($DatabaseTableName);
   
   
//Build Select Query
   
$TableName="Student";
   
$Condition="StMarks>40";
   
$OrderByCol="StId";
   
$SelQuery=$ObjConnection->BuildSelectQuery($TableName,$Condition="",$OrderByCol="");
    echo
$SelQuery;
   
   
//Build Update Query
   
$DatabaseTableName="Student";
   
$UpdateFieldsAndValues=array("StRoll"=>"33",
                                
"StMarks"=>"59");
   
$UpdateCondition="StId=3";
   
$UpdateQuery=$ObjConnection->BuildUpdateQuery($DatabaseTableName,$UpdateFieldsAndValues,$UpdateCondition);
    echo
$UpdateQuery;

   
//Build Delete Query
   
$TableName="Student";
   
$Condition="StId=2";
   
$DeleteQuery=$ObjConnection->BuildDeleteQuery($TableName,$Condition="")
    echo
$DeleteQuery;
   
   
//Delete A Single File
   
$ImageName="aminul.jpg";
   
$FolderLocation="all_image";
   
$SuccessMessage="File Successfully Deleted.";
   
$FailureMessage="Image Can't Deleted.";
   
$DelFile=$ObjConnection->DeleteFile($ImageName,$FolderLocation,$SuccessMessage,$FailureMessage);
    echo
$DelFile;
   
   
//Delete All Files within Folder: all_image
   
$ImageName="";
   
$FolderLocation="all_image";
   
$SuccessMessage="File Successfully Deleted.";
   
$FailureMessage="Image Can't Deleted.";
   
$DelFile=$ObjConnection->DeleteFile($ImageName,$FolderLocation,$SuccessMessage,$FailureMessage);
    echo
$DelFile;
?>