PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Tufan Baris YILDIRIM   PHP MySQL Grid   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Grid File
Class: PHP MySQL Grid
Display MySQL query results in an HTML table
Author: By
Last change: using important function and examples
Date: 14 years ago
Size: 2,326 bytes
 

Contents

Class file image Download
<html>
<head>
<meta http-equiv="content-language" content="TR">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="PhpED Version 5.6 (Build 5615)">
<title>D3Sql Grid Example</title>
<meta name="author" content="Tufan Bar&#305;l YILDIRIM www.tufyta.com">
<meta http-equiv="reply-to" content="dellytufy@hotmail.com">
<link rel="shortcut icon" href="|">
<style type="text/css">
.example_thead_style td{
    font-size:14px;
    font-family: Tahoma;
    border:#ddd 1px solid;
    padding:10px;
    background:#eee;
}
.example_row1_style td{
      border:1px solid;
      font-size:13px;
      padding:10px;
      background:#ddd;
      font-weight: 700;
}
.example_row2_style td{
      border:1px solid;
      font-size:13px;
      padding:10px;
      background:#eee;
      font-weight: 700;
}
</style>
</head>

<body>
<?php
  
include 'd3sql_grid.php';
 
   
$db = new D3Sql;
   
$db->baglan('localhost','root','password'); // Connecting Mysql Server
   
$db->dbsec('ihale'); // Select Database
 
  
$db->sql("SELECT id,username FROM users"); // Execute Query return Datasource
  
  
?>
<h2>Before Style And Template</h2>
   <?
   
echo $db->grid(); // Print Grid
  
?>
<h2>After Style without Template</h2>
   <?
   $db
->style=array(
  
'row1'=>'example_row1_style',
  
'row2'=>'example_row2_style',
  
'thead'=>'example_thead_style'
  
);

 
   echo
$db->grid(); // Print Grid With Style.
  
?>

    <h2>With Style And template</h2>
   <?
    $db
->sutun_template('username','<a href=user_profile.php?id={$id}>{$username}</a>');

// Column names
$db->sutun_adlari=array('username'=>'User Name','id'=>'User ID');

$db->aktif_sutunlar('username'); // only username will be showed
   
echo $db->grid(); // Print Grid With Style and template.
   
?>
<h3>Debug Info</h3>
    <?
   
echo 'This Page Created on '.$db->totalTime().' Seconds with '.$db->sqlCount().' Sql Query And '.count($db->tum_hatalar).' Error(s)'; // Can Create more grid with only 1 query.
   
echo '<br><a href="http://www.tufyta.com">Tufyta</a>'; // Can Create more grid with only 1 query.
?>
</body>
</html>