PHP Classes

File: examples/select.php

Recommend this page to a friend!
  Classes of Mohamed Elbahja   MySQLi Manager   examples/select.php   Download  
File: examples/select.php
Role: Example script
Content type: text/plain
Description: Example script
Class: MySQLi Manager
Execute MySQL queries from parameters using MySQLi
Author: By
Last change: Update select.php
Date: 8 years ago
Size: 716 bytes
 

Contents

Class file image Download
<?php

/**
 * select example
 */

require 'db_config.php';

/* Connect DB */
$db->conn();

// select one
// ex : $db->escape($_GET['id'])

$id = $db->escape(1);

$ex1 = $db->select_one('title, description, text', 'example_table', "WHERE id='$id'");
echo
'select_one<br/>';
if (
$ex1 !== null) {

    echo
$ex1['title'] . '<br />';
    echo
$ex1['description']. '<br />';
    echo
$ex1['text'];

}


echo
'<br /><br /><br /><br /> SELECT <br/><br />';

// select

$ex2 = $db->select('title, description, text', 'example_table', 'LIMIT 10');

while (
$ex = $ex2->fetch_assoc()) {

    echo
$ex1['title'] . '<br />';
    echo
$ex1['description']. '<br />';
    echo
$ex1['text']. '<br/><br/><br/>';
}

$ex2->close();

$db->close();


?>