<?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';
}
?>
|