PHP Classes

File: selassoc.php

Recommend this page to a friend!
  Classes of Ahmed   MySQL DB Management Class   selassoc.php   Download  
File: selassoc.php
Role: Example script
Content type: text/plain
Description: example to use selassoc method
Class: MySQL DB Management Class
Execute MySQL queries and show paginated results
Author: By
Last change:
Date: 16 years ago
Size: 948 bytes
 

Contents

Class file image Download
<?php

/**
 * @package Mysql DB Management Examples
 * @author Ahmed Elbshry(bondo2@bondo2.info)
 * @copyright 2008
 * @access public
 */

try{
    require
'./db.class.php';
   
//الاتصال بقاعدة البيانات مع واخذ نسخه من الكلاس فى خطوة واحده
   
$db = new DB('localhost','root','');
   
   
//اختيار قاعدة البيانات التى سنتعامل معها
   
$db->UseDB('information_schema');
   
   
//كيفية الاستعلام واستخراج النتيجة فى مصفوفة حرفية مفاتيحها هى اسماء الحقول
   
$rsAssoc = $db->SelAssoc("SELECT * FROM CHARACTER_SETS");
   
//print_r($rsAssoc);
   
echo "<table><tr><th colspan='4'><center>Using SelAssoc Function</center></th></tr>";
    for(
$i=0;$i<count($rsAssoc);$i++) {
        echo
"<tr><td>".$rsAssoc[$i]['CHARACTER_SET_NAME']."</td><td>".$rsAssoc[$i]['DEFAULT_COLLATE_NAME']."</td><td>".$rsAssoc[$i]['DESCRIPTION']."</td><td>".$rsAssoc[$i]['MAXLEN']."</td></tr>";
    }
    echo
"</table>";

   
$db->Close();
}
catch(
exception $e) {
    echo
$e->getMessage();
}
?>