当前位置: 首页>>代码示例>>PHP>>正文


PHP Database::table方法代码示例

本文整理汇总了PHP中Database::table方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::table方法的具体用法?PHP Database::table怎么用?PHP Database::table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


在下文中一共展示了Database::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: M

function M($table_name)
{
    $db = new Database("localhost", 3306, "messengershop", "root", "");
    $prefix = "";
    //定义表前缀
    return $db->table($prefix . $table_name);
}
开发者ID:jokin1999,项目名称:class-mysqli,代码行数:7,代码来源:demo.php

示例2: database

 private function database($name)
 {
     if ($this->db) {
         return $this->db;
     }
     $this->db = Database::table($name);
     return $this->db;
 }
开发者ID:chenyongze,项目名称:m3d,代码行数:8,代码来源:Model.class.php

示例3: init_connection

 public static function init_connection($host, $db, $table, $username, $password)
 {
     self::$host = $host;
     self::$db = $db;
     self::$table = $table;
     self::$user = $username;
     self::$password = $password;
     self::$mysqli = new mysqli(self::$host, self::$user, self::$password, self::$db);
     return self::$mysqli->ping();
 }
开发者ID:mozillo,项目名称:apibuilder,代码行数:10,代码来源:class.Database.inc.php

示例4: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$institutions_records = $gui->select('institutions');
$places_records = $gui->joinThree('institutions', 'places_for_institutions', 'places', 'city', 'institution_id', 'place_id');
if (!empty($_POST)) {
    $post_institution = $_POST['institution'];
    $db->table('institutions');
    $validator = new Validator($db, $errorHandler);
    $validation = $validator->check($_POST, ['institution' => ['required' => true]]);
    if ($validation->fails()) {
        echo '<pre>', print_r($validation->errors()->all()), '</pre>';
    } else {
        $insert_institution = ['institution' => $post_institution];
        if ($db->insert($insert_institution)) {
            $last_id = $db->lastID();
            if ($_POST['place']) {
                $post_place = $_POST['place'];
                for ($m = 0; $m < count($post_place); $m++) {
                    $insert_place = ['place_id' => $post_place[$m], 'institution_id' => $last_id];
                    $db->table('places_for_institutions')->insert($insert_place);
                }
            }
            header('Location: create_institutions.php');
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:create_institutions.php

示例5: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$exhibition_types_records = $gui->select('exhibition_types');
if (!empty($_POST)) {
    $db->table('exhibition_types');
    if ($db->delete($_POST['id'])) {
        header('Location: delete_exhibition_types.php');
        die;
    }
}
?>

<!doctype html>
	<html>
	<head>
		<title>Delete exhibition types</title>
		<link rel="stylesheet" type="text/css" href="../../public/front/css/admin.css">
	</head>
	<body style="font-family:Helvetica;font-size:12px">
		<h3>Exhibition types</h3>
		<h4>Delete exhibition type</h4>

		<?php 
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:delete_exhibition_types.php

示例6: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$media_types_records = $gui->select('media_types');
if (!empty($_POST)) {
    $db->table('media_types');
    $validator = new Validator($db, $errorHandler);
    $validation = $validator->check($_POST, ['media_type' => ['required' => true]]);
    if ($validation->fails()) {
        echo '<pre>', print_r($validation->errors()->all()), '</pre>';
    } else {
        if ($db->insert($_POST)) {
            header('Location: create_media_types.php');
            die;
        }
    }
}
?>

<!doctype html>
	<html>
	<head>
		<title>Create media types</title>
		<link rel="stylesheet" type="text/css" href="../../public/front/css/admin.css">
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:create_media_types.php

示例7: Database

<?php

/**
 * Connect to database
 */
$db = new Database();
/**
 * Select all rows from table users
 */
$rows = $db->table('users')->select();
/**
 * Select all rows from table users, where user_id = 1, or user id = 5
 */
$rows = $db->table('users')->where(null, 'user_id', '=', 1)->where('or', 'user_id', '=', 5) - select();
/**
 * Insert new row to table quz, foo = hello, and bar = world
 */
$db->table('quz')->fields('foo', 'bar')->values('hello', 'world')->insert();
/**
 * Delete a row from table quz where foo = hello and bar = world
 */
$db->table('quz')->where('', 'foo', '=', 'hello')->where('and', 'bar', '=', 'world')->delete();
开发者ID:bluzi,项目名称:simple-mvc-system,代码行数:22,代码来源:Database+Examples.php

示例8: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$institutions_records = $gui->select('institutions');
$places_records = $gui->joinThree('institutions', 'places_for_institutions', 'places', 'city', 'institution_id', 'place_id');
if (!empty($_POST)) {
    $db->table('institutions');
    if ($db->delete($_POST['id'])) {
        $db->table('places_for_institutions');
        $db->deleteWhich($_POST['id'], 'institution_id');
        $db->table('institutions_for_collections');
        $db->deleteWhich($_POST['id'], 'institution_id');
        $db->table('institutions_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'institution_id');
        $db->table('institutions_for_prizes');
        $db->deleteWhich($_POST['id'], 'institution_id');
        header('Location: delete_institutions.php');
        die;
    }
}
?>

<!doctype html>
	<html>
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:delete_institutions.php

示例9: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$spaces_records = $gui->select('spaces');
$places_records = $gui->joinThree('spaces', 'places_for_spaces', 'places', 'city', 'space_id', 'place_id');
if (!empty($_POST)) {
    $post_space = $_POST['space'];
    $db->table('spaces');
    $validator = new Validator($db, $errorHandler);
    $validation = $validator->check($_POST, ['space' => ['required' => true]]);
    if ($validation->fails()) {
        echo '<pre>', print_r($validation->errors()->all()), '</pre>';
    } else {
        $insert_space = ['space' => $post_space];
        if ($db->insert($insert_space)) {
            $last_id = $db->lastID();
            if ($_POST['place']) {
                $post_place = $_POST['place'];
                for ($m = 0; $m < count($post_place); $m++) {
                    $insert_place = ['place_id' => $post_place[$m], 'space_id' => $last_id];
                    $db->table('places_for_spaces')->insert($insert_place);
                }
            }
            header('Location: create_spaces.php');
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:create_spaces.php

示例10: ErrorHandler

$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$exhibitions_records = $gui->select('exhibitions');
$exhibition_types_records = $gui->rightJoin('type', 'exhibition_types', 'exhibition_type');
$exhibition_kinds_records = $gui->rightJoin('kind', 'exhibition_kinds', 'exhibition_kind');
$events_records = $gui->joinThree('exhibitions', 'events_for_exhibitions', 'events', 'event', 'exhibition_id', 'event_id');
$spaces_records = $gui->joinThree('exhibitions', 'spaces_for_exhibitions', 'spaces', 'space', 'exhibition_id', 'space_id');
$places_records = $gui->joinThree('exhibitions', 'places_for_exhibitions', 'places', 'city', 'exhibition_id', 'place_id');
$projects_records = $gui->joinThree('exhibitions', 'exhibitions_for_projects', 'projects', 'project', 'exhibition_id', 'project_id');
$institutions_records = $gui->joinThree('exhibitions', 'institutions_for_exhibitions', 'institutions', 'institution', 'exhibition_id', 'institution_id');
$people_org_records = $gui->joinThree('exhibitions', 'people_for_exhibitions_org', 'people', 'name', 'exhibition_id', 'person_id');
$people_curatorship_records = $gui->joinThree('exhibitions', 'people_for_exhibitions_curatorship', 'people', 'name', 'exhibition_id', 'person_id');
$people_participants_records = $gui->joinThree('exhibitions', 'people_for_exhibitions_participants', 'people', 'name', 'exhibition_id', 'person_id');
if (!empty($_POST)) {
    $db->table('exhibitions');
    if ($db->delete($_POST['id'])) {
        $db->table('events_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
        $db->table('spaces_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
        $db->table('places_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
        $db->table('projects_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
        $db->table('institutions_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
        $db->table('people_for_exhibitions_org');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
        $db->table('people_for_exhibitions_curatorship');
        $db->deleteWhich($_POST['id'], 'exhibition_id');
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:delete_exhibitions.php

示例11: ErrorHandler

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$works_records = $gui->select('works');
$media_records = $gui->joinThree('works', 'media_for_works', 'media', 'media_title', 'work_id', 'media_id');
$categories_records = $gui->joinThree('works', 'categories_for_works', 'categories', 'category', 'work_id', 'category_id');
$techniques_records = $gui->joinThree('works', 'techniques_for_works', 'techniques', 'technique', 'work_id', 'technique_id');
$technologies_records = $gui->joinThree('works', 'technologies_for_works', 'technologies', 'technology', 'work_id', 'technology_id');
if (!empty($_POST)) {
    $db->table('works');
    if ($db->delete($_POST['id'])) {
        $db->table('media_for_works');
        $db->deleteWhich($_POST['id'], 'work_id');
        $db->table('categories_for_works');
        $db->deleteWhich($_POST['id'], 'work_id');
        $db->table('techniques_for_works');
        $db->deleteWhich($_POST['id'], 'work_id');
        $db->table('technologies_for_works');
        $db->deleteWhich($_POST['id'], 'work_id');
        $db->table('works_for_projects');
        $db->deleteWhich($_POST['id'], 'work_id');
        header('Location: delete_works.php');
        die;
    }
}
开发者ID:pfv,项目名称:folio,代码行数:30,代码来源:delete_works.php

示例12: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$companies_records = $gui->select('companies');
if (!empty($_POST)) {
    $db->table('companies');
    $validator = new Validator($db, $errorHandler);
    $validation = $validator->check($_POST, ['company' => ['required' => true], 'website' => ['required' => false], 'description' => ['required' => false], 'year_start' => ['required' => true], 'year_end' => ['required' => false]]);
    if ($validation->fails()) {
        echo '<pre>', print_r($validation->errors()->all()), '</pre>';
    } else {
        echo '<pre>', print_r($_POST), '</pre>';
        if ($db->insert($_POST)) {
            header('Location: create_companies.php');
            die;
        }
    }
}
?>

<!doctype html>
	<html>
	<head>
		<title>Create companies</title>
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:create_companies.php

示例13: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$categories_records = $gui->select('categories');
if (!empty($_POST)) {
    $db->table('categories');
    $validator = new Validator($db, $errorHandler);
    $validation = $validator->check($_POST, ['category' => ['required' => true, 'unique' => 'categories']]);
    if ($validation->fails()) {
        echo '<pre>', print_r($validation->errors()->all()), '</pre>';
    } else {
        if ($db->insert($_POST)) {
            header('Location: create_categories.php');
            die;
        }
    }
}
?>

<!doctype html>
	<html>
	<head>
		<title>Create categories</title>
		<link rel="stylesheet" type="text/css" href="../../public/front/css/admin.css">
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:create_categories.php

示例14: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$people_records = $gui->select('people');
if (!empty($_POST)) {
    $db->table('people');
    if ($db->delete($_POST['id'])) {
        $db->table('people_for_exhibitions_curatorship');
        $db->deleteWhich($_POST['id'], 'person_id');
        $db->table('people_for_exhibitions_org');
        $db->deleteWhich($_POST['id'], 'person_id');
        $db->table('people_for_exhibitions_participants');
        $db->deleteWhich($_POST['id'], 'person_id');
        $db->table('people_for_projects_author');
        $db->deleteWhich($_POST['id'], 'person_id');
        $db->table('people_for_projects_collaboration');
        $db->deleteWhich($_POST['id'], 'person_id');
        header('Location: delete_people.php');
        die;
    }
}
?>

<!doctype html>
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:delete_people.php

示例15: ErrorHandler

<?php

require '../../classes/Database.php';
require '../../classes/Validator.php';
require '../../classes/ErrorHandler.php';
require '../../classes/AdminGui.php';
require '../../functions/security.php';
$errorHandler = new ErrorHandler();
$db = new Database();
$gui = new AdminGui($db);
$spaces_records = $gui->select('spaces');
$places_records = $gui->joinThree('spaces', 'places_for_spaces', 'places', 'city', 'space_id', 'place_id');
if (!empty($_POST)) {
    $db->table('spaces');
    if ($db->delete($_POST['id'])) {
        $db->table('places_for_spaces');
        $db->deleteWhich($_POST['id'], 'space_id');
        $db->table('spaces_for_exhibitions');
        $db->deleteWhich($_POST['id'], 'space_id');
        header('Location: delete_spaces.php');
        die;
    }
}
?>

<!doctype html>
	<html>
	<head>
		<title>Delete spaces</title>
		<link rel="stylesheet" type="text/css" href="../../public/front/css/admin.css">
	</head>
开发者ID:pfv,项目名称:folio,代码行数:31,代码来源:delete_spaces.php


注:本文中的Database::table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。