PHP Classes
elePHPant
Icontem

File: defaultFunx.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of raja  >  Login and DB classes quick start  >  defaultFunx.php  >  Download  
File: defaultFunx.php
Role: Auxiliary script
Content type: text/plain
Description: select , insert , delete , update , functions Templates
Class: Login and DB classes quick start
Authenticate users with records in MySQL database
Author: By
Last change:
Date: 7 years ago
Size: 1,594 bytes
 

Contents

Class file image Download
<?php
require_once dirname(__FILE__)."/../config.php";
require_once
dirname(__FILE__)."/SqlFunctions.php";
    
     
   
////////////////Select Examples //////////////////////////////////
    //GetSingleRow is for Fetching A Signle Row .
    //GetAllRows is for Fetching Multiple Rows , after Return use foreach(); to display
   
   
   
function getDetails(){
   
$sql="select * from myTable where userid='1'";
   
$SingleRow=GetSingleRow($sql);
    return
$SingleRow;
    }
    function
getTotal(){
   
$sql="select count(*) as total from myTable where status='1'";
   
$total=GetSingleRow($sql);
    return
$totalmyTable=$total['total'];
    }
    function
getRecord($eu,$limit){
    
$sql="select * from myTable ORDER BY userid DESC limit $eu, $limit";
   
$allData=GetAllRows($sql);
    return
$allData;
    }
    function
getRecordAsc($eu,$limit,$by){
    
$sql="select * from myTable ORDER by $by ASC limit $eu, $limit ";
   
$allData=GetAllRows($sql);
    return
$allData;
    }
    function
getRecordDes($eu,$limit,$by){
   
$sql="select * from myTable ORDER BY $by DESC limit $eu, $limit";
   
$allData=GetAllRows($sql);
    return
$allData;
    }
   
?>

    <?
   
/////////////////////////////// Update ,Delete and Insert//////////////////////////////////////////
   
function updateRecord($value){
   
$sql="update myTable set status='1' where value='$value'";
    
ExecuteQuery($sql);
    }
   
    function
operation($value){
   
$sql="delete from myTable where value='$value'";
    
ExecuteQuery($sql);
   
    }
   
    function
insertRecord($value)
    {
   
$sql="insert myTable set firstname='$value'";
   
ExecuteQuery($sql);
    return
'1';
    }
 
?>