setPrefix() 공개 메소드

Method to set a prefix
public setPrefix ( string $prefix = '' ) : MysqliDb
$prefix string Contains a tableprefix
리턴 MysqliDb
예제 #1
0
        $output .= '/>';
    }
    return $output;
}
function build_link_list($list)
{
    if ($list) {
        foreach ($list as $key => $val) {
            if ($val['img_path']) {
                $img = '<img src="' . $val['img_path'] . '" alt="' . $val['title'] . '" /> ';
            } else {
                $img = '';
            }
            if (substr($val['url'], 0, 4) != 'http') {
                $val['url'] = 'http://' . $val['url'];
            }
            $output .= '<li>' . build_hyperlink($val['url'], '', '', $img . $val['title']) . '</li>' . "\n";
        }
    }
    return $output;
}
/* ! Load classes * * * * * * * */
require_once DIR_SYSTEM . 'MysqliDb.php';
$_db = new MysqliDb($setup['db_host'], $setup['db_user'], $setup['db_pswd'], $setup['db_name']);
$_db->setPrefix('grlx_');
if (!$_db) {
    die('<h1>Holy null records, Batman! The database is missing!</h1><p>Even worse, Robin, the first-run installation script is gone. This is a critical error. <a href="http://twitter.com/grawlixcomix">Better call for backup</a>.</p>');
}
spl_autoload_register(null, false);
spl_autoload_extensions('.php');
spl_autoload_register('grlx_load');
예제 #2
0
<?php

require_once 'vendor/autoload.php';
require_once 'config/settings.php';
include 'functions.php';
//read input data
$data = json_decode(file_get_contents('php://input'), true);
if ($data == null || $data == "" || !isset($data['message'])) {
    die;
}
$db = new MysqliDb(HOST, DB_USER, DB_PASSWORD, DATABASE);
$db->setPrefix('soft_');
$text = '';
$chatid = '';
try {
    //catch user info
    $chatid = $data['message']['chat']['id'];
    $first_name = isset($data['message']['chat']['first_name']) ? $data['message']['chat']['first_name'] : '';
    $last_name = isset($data['message']['chat']['last_name']) ? $data['message']['chat']['last_name'] : '';
    $username = isset($data['message']['chat']['username']) ? $data['message']['chat']['username'] : '';
    $db->insert('users', array('ID' => $chatid, 'first_name' => $first_name, 'last_name' => $last_name, 'username' => $username));
    //catch message data
    $text = $data['message']['text'];
    $messageid = $data['message']['message_id'];
    $updateid = $data['update_id'];
    $senderid = $data['message']['from']['id'];
    $date = $data['message']['date'];
    $messageid = $data['message']['message_id'];
    $db->insert('received', array('ID' => $username, 'Message_id' => $messageid, 'User_id' => $senderid, 'Date' => $date, 'Text' => $text));
} catch (Exception $e) {
    error_log("خطا در دریافت اطلاعات\n\n" . $e->getMessage());