PHP Classes

File: example3.php

Recommend this page to a friend!
  Classes of Osama Salama   DBMysqli   example3.php   Download  
File: example3.php
Role: Example script
Content type: text/plain
Description: example3
Class: DBMysqli
Access MySQL databases with mysql and mysqli
Author: By
Last change:
Date: 9 years ago
Size: 2,029 bytes


Class file image Download
require_once "Database.php";


choose MYSQL or MYSQLi

//fetchAll and pagination
$fileds="*"; // you can use ( * ) or array contains column array('ID','email','name');
$tablename="orders"; //tablename
$con=false; //where condition like category='sport' or category='sport' :if no condition type false
$join=false; //if no join type false or array like array("left join cm_cat on")
$group=false; // :if no group type false ex. like "cm_articles.ID";
$order='ID asc'; //if no order type false
$start=false; // if you are using pagination write page number if not type false
$limit=false; // all record type false if not type record limit
 foreach($rs1 as $row){
     echo $row['ID']."==".$row['name']."<br/>\n";

1==osama salama
2==ali ahmed ali
3==Tamer sami
4==Mohammed ali
5==ahmed mahmmod
6==ali elsied ali
7==walled sami
8==waeel helal
9==joen apo
10==mostafa hafez
11==alaa elsedd ali
12==abdo hablex
example inline fetch

//use in pagination
echo "<hr/>";
if(!isset($_GET['page']) or $_GET['page']==0){
    else {
$limit=15; //for record in page

 foreach($rs2 as $row){
     echo $row['ID']."==".$row['name']."<br/>\n";

 $link='&cat=5'; // like $link="&cat=5"; like
echo $DB->pagination($page,$limit,$link,$rowcount,'Next Page','Prev Page','First Page','Last Page');