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


PHP MyDB::prepare方法代码示例

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


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

示例1: MyDB

<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$accl_id = $_POST['accl'];
if (!empty($accl_id)) {
    $db = new MyDB();
    $stmt = $db->prepare('SELECT name, library, backend, input, dim_x, dim_y, NNZ, value_type, value 
						FROM master WHERE accl_id=:aid;');
    $stmt->bindParam(':aid', $accl_id, SQLITE3_INTEGER);
    $results = $stmt->execute();
    print "<table border='1'>";
    print "<tr>\n\t\t\t<td>Name</td>\n\t\t\t<td>Library</td>\n\t\t\t<td>Backend</td>\n\t\t\t<td>Input</td>\n\t\t\t<td>dim_x</td>\n\t\t\t<td>dim_y</td>\n\t\t\t<td>NNZ</td>\n\t\t\t<td>Metric</td>\n\t\t\t<td>Value</td>\n\t\t\t</tr>";
    while ($row = $results->fetchArray()) {
        print "<tr>\n\t\t\t\t<td>" . $row['name'] . "</td>\n\t\t\t\t<td>" . $row['library'] . "</td>\n\t\t\t\t<td>" . $row['backend'] . "</td>\n\t\t\t\t<td>" . $row['input'] . "</td>\n\t\t\t\t<td>" . $row['dim_x'] . "</td>\n\t\t\t\t<td>" . $row['dim_y'] . "</td>\n\t\t\t\t<td>" . $row['NNZ'] . "</td>\n\t\t\t\t<td>" . $row['value_type'] . "</td>\n\t\t\t\t<td>" . $row['value'] . "</td>\n\t\t\t\t</tr>";
    }
    print "</table>";
}
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:23,代码来源:query_accl.php

示例2: MyDB

<?php

include 'prereq.php';
$db = new MyDB();
if (isset($_POST['o']) && isset($_POST['n']) && isset($_POST['c'])) {
    $stm = $db->prepare("INSERT INTO attacks (orig_url, new_url, control_code) VALUES (?,?,?)");
    $stm->bindParam(1, $_POST['o'], SQLITE3_TEXT);
    $stm->bindParam(2, $_POST['n'], SQLITE3_TEXT);
    $stm->bindParam(3, $_POST['c'], SQLITE3_TEXT);
    $stm->execute();
    print "ok";
} else {
    print "Error";
}
$db->close();
unset($db);
开发者ID:ndrix,项目名称:xwindow-redirect,代码行数:16,代码来源:addAttack.php

示例3: MyDB

<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$hostname = $_POST['hostname'];
if (!empty($hostname)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into hosts (hostname) values (:hn)");
    $stmt->bindParam(':hn', $hostname, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $host_id = $db->lastInsertRowID();
        print "Inserted row with host_id = " . $host_id;
    }
}
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:20,代码来源:put_host.php

示例4: MyDB

    }
}
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
} else {
    echo "[[Opened database successfully YAY!!!]]";
}
//require 'db_functions.php';
$feedback = $_POST['commentBox'];
$email = $_POST['email'];
//Convert whitespaces and underscore to dash
//$feedback = preg_replace("/[\s_]/", "_", $feedback);
//$email = preg_replace('/@/', '^', $email);
$insert = "INSERT INTO feedback (feedback, email) VALUES ('" . $feedback . "','" . $email . "');";
$ret = $db->prepare($insert);
if (!$ret) {
    echo "<p>" . $db->lastErrorMsg() . "<p>";
} else {
    echo "Records created successfully\n";
}
$display = $db->query($getAllValues);
while ($row = $display->fetchArray(SQLITE3_ASSOC)) {
    echo $row['feedback'];
    echo $row['feedback'];
}
echo "<p>{$feedback}</p>";
?>
        <h2>Thank you for your Feedback</h2>

        <p> something!!!!!</p>
开发者ID:taksaru,项目名称:2016project,代码行数:31,代码来源:thankyou.php

示例5: isset

<?php

define('AJAX_REQUEST', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if (!AJAX_REQUEST) {
    die;
}
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('physique.db');
    }
}
$booth = $_POST['booth'];
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$statement = $db->prepare('delete from booth where number=:booth');
$statement->bindValue(':booth', $booth);
$result = $statement->execute();
var_dump($result);
$db->close();
开发者ID:aftalavera,项目名称:floor,代码行数:23,代码来源:delete.php

示例6: MyDB

<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$bench = $_POST['bench'];
if (!empty($bench)) {
    $db = new MyDB();
    $stmt = $db->prepare("SELECT accl_name, library, backend, input, dim_x, dim_y, NNZ, value_type, value \n\t\t\t\t\t\tFROM master WHERE lower(name) LIKE :pb");
    $stmt->bindParam(':pb', $bench, SQLITE3_TEXT);
    $results = $stmt->execute();
    print "<table border='1'>";
    print "<tr>\n\t\t\t<td>Hardware</td>\n\t\t\t<td>Library</td>\n\t\t\t<td>Backend</td>\n\t\t\t<td>Input</td>\t\t\t\n\t\t\t<td>dim_x</td>\n\t\t\t<td>dim_y</td>\n\t\t\t<td>NNZ</td>\n\t\t\t<td>Metric</td>\n\t\t\t<td>Value</td>\n\t\t\t</tr>";
    while ($row = $results->fetchArray()) {
        print "<tr>\n\t\t\t\t<td>" . $row['accl_name'] . "</td>\n\t\t\t\t<td>" . $row['library'] . "</td>\n\t\t\t\t<td>" . $row['backend'] . "</td>\n\t\t\t\t<td>" . $row['input'] . "</td>\n\t\t\t\t<td>" . $row['dim_x'] . "</td>\n\t\t\t\t<td>" . $row['dim_y'] . "</td>\n\t\t\t\t<td>" . $row['NNZ'] . "</td>\n\t\t\t\t<td>" . $row['value_type'] . "</td>\n\t\t\t\t<td>" . $row['value'] . "</td>\n\t\t\t\t</tr>";
    }
    print "</table>";
}
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:22,代码来源:query_bench.php

示例7: MyDB

{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$os = $_POST['os'];
$compiler = $_POST['compiler'];
$version = $_POST['version'];
$flags = $_POST['flags'];
$library = $_POST['library'];
$library_ver = $_POST['library_ver'];
$backend = $_POST['backend'];
$backend_ver = $_POST['backend_ver'];
if (!empty($os) and !empty($compiler) and !empty($version) and !empty($flags) and !empty($library) and !empty($library_ver) and !empty($backend) and !empty($backend_ver)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into systems \n\t\t\t\t\t\t(os, compiler, version, flags, library, library_ver, backend, backend_ver) \n\t\t\t\t\t\tvalues (:o, :c, :v, :f, :l, :lv, :b, :bv)");
    $stmt->bindParam(':o', $os, SQLITE3_TEXT);
    $stmt->bindParam(':c', $compiler, SQLITE3_TEXT);
    $stmt->bindParam(':v', $version, SQLITE3_TEXT);
    $stmt->bindParam(':f', $flags, SQLITE3_TEXT);
    $stmt->bindParam(':l', $library, SQLITE3_TEXT);
    $stmt->bindParam(':lv', $library_ver, SQLITE3_TEXT);
    $stmt->bindParam(':b', $backend, SQLITE3_TEXT);
    $stmt->bindParam(':bv', $backend_ver, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $system_id = $db->lastInsertRowID();
        print "Inserted row with system_id = " . $system_id;
    }
}
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:31,代码来源:put_system.php

示例8: register

/**
 * This function connects to the SQLite database ('apollo.db') and
 * inserts a new user with $user_name, $user_password, and $user_birthday
 * values. It returns true/false.
 */
function register($user_name, $user_password, $user_birthday)
{
    $db = new MyDB();
    $statement = $db->prepare("\n       INSERT INTO users(user_name, user_password, user_birthday) VALUES('{$user_name}', '{$user_password}', '{$user_birthday}')");
    return $statement->execute();
}
开发者ID:unbrace3,项目名称:unbrace3.github.io,代码行数:11,代码来源:apollo.php

示例9: MyDB

    }
}
$where = $_POST['where'];
if (empty($where)) {
    $where = '1=1';
}
$sel = "";
foreach ($_POST as $key => $value) {
    if ($key != 'where' and $key != 'action') {
        $sel .= $value . ", ";
    }
}
$sel .= "value_type, value";
if (!empty($sel) and !empty($where)) {
    $db = new MyDB();
    $stmt = $db->prepare("select " . $sel . " from master where " . $where . " ;");
    $results = $stmt->execute();
    $num_cols = count($_POST);
    if ($_POST['action'] == 'Show Results') {
        print "<table border='1'>";
        print "<tr>";
        foreach ($_POST as $key => $value) {
            if ($key != 'where' and $key != 'action') {
                print "<td><b>" . $key . "</td>";
            }
        }
        print "<td><b> Metric Measured</td>";
        print "<td><b> Value </td>";
        print "</tr>";
        while ($row = $results->fetchArray()) {
            print "<tr>";
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:31,代码来源:query_detail.php

示例10: MyDB

		<tbody>

<?php 
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('starwars_media.db');
    }
}
$db = new MyDB();
if (!$db) {
    print $db->lastErrorMsg();
} else {
}
$sql = $db->prepare("\n     SELECT mid,\n          \ttitle,\n          \tpid,\n          \tpublish_date,\n          \tyear,\n          \tepid,\n          \terid,\n          \tcid,\n          \ttid,\n          \thave,\n          \treference,\n          \tedition,\n          \tnotes\n       FROM media;");
$ret = $sql->execute();
while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
    $mid = $row['mid'];
    $rsql = "SELECT fullname\n                 FROM author\n                WHERE aid = (SELECT aid\n                               FROM media_author\n                              WHERE mid = {$mid})";
    $rret = $db->query($rsql);
    $author_list = '';
    while ($rrow = $rret->fetchArray(SQLITE3_ASSOC)) {
        $author_list .= $rrow['fullname'];
    }
    $pid = $row['pid'];
    $publisher = '';
    if ($pid != '') {
        $psql = "SELECT publisher\n                 FROM publisher\n                WHERE pid = {$pid}";
        $pret = $db->query($psql);
        while ($prow = $pret->fetchArray(SQLITE3_ASSOC)) {
开发者ID:eniad,项目名称:starwars-db,代码行数:31,代码来源:index.php

示例11: MyDB

<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$url = $_POST['url'];
$hash = $_POST['hash'];
if (!empty($url) and !empty($hash)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into sources (URL, commit_hash) values (:u, :ch)");
    $stmt->bindParam(':u', $url, SQLITE3_TEXT);
    $stmt->bindParam(':ch', $hash, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $source_id = $db->lastInsertRowID();
        print "Inserted row with source_id = " . $source_id;
    }
}
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:22,代码来源:put_source.php

示例12: MyDB

<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$type = $_POST['type'];
$accl_name = $_POST['accl_name'];
$arch = $_POST['arch'];
$memory = $_POST['memory'];
$cores = $_POST['cores'];
$details = $_POST['type'];
if (!empty($type) and !empty($accl_name) and !empty($arch) and !empty($memory) and !empty($cores) and !empty($details)) {
    $db = new MyDB();
    $stmt = $db->prepare("insert into accelerators \n\t\t\t\t\t\t(type, accl_name, arch, memory, cores, details) \n\t\t\t\t\t\tvalues (:t, :an, :ar, :m, :c, :d)");
    $stmt->bindParam(':t', $type, SQLITE3_TEXT);
    $stmt->bindParam(':an', $accl_name, SQLITE3_TEXT);
    $stmt->bindParam(':ar', $arch, SQLITE3_TEXT);
    $stmt->bindParam(':m', $memory, SQLITE3_INTEGER);
    $stmt->bindParam(':c', $cores, SQLITE3_INTEGER);
    $stmt->bindParam(':d', $details, SQLITE3_TEXT);
    $ret = $stmt->execute();
    if (!empty($ret)) {
        $accl_id = $db->lastInsertRowID();
        print "Inserted row with accl_id = " . $accl_id;
    }
}
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:30,代码来源:put_accl.php

示例13: MyDB

<?php

include 'prereq.php';
$db = new MyDB();
if (isset($_POST['v']) && (int) $_POST['v'] > 0) {
    $stm = $db->prepare("DELETE FROM victims WHERE id = ?");
    $stm->bindParam(1, $_POST['v'], SQLITE3_INTEGER);
    $stm->execute();
    print "ok";
} else {
    print "Error";
}
$db->close();
unset($db);
开发者ID:ndrix,项目名称:xwindow-redirect,代码行数:14,代码来源:rmVictim.php

示例14: MyDB

<?php

include 'prereq.php';
$db = new MyDB();
if (isset($_POST['i']) && isset($_POST['n'])) {
    $stm = $db->prepare("UPDATE victims SET action = 1, new_url = ? WHERE id = ?");
    $stm->bindParam(1, $_POST['n'], SQLITE3_TEXT);
    $stm->bindParam(2, $_POST['i'], SQLITE3_INTEGER);
    $stm->execute();
    print "ok";
} else {
    print "Error";
}
$db->close();
unset($db);
开发者ID:ndrix,项目名称:xwindow-redirect,代码行数:15,代码来源:doFlip.php

示例15: MyDB

<?php

class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('perfdb');
    }
}
$table = $_POST['table'];
if (!empty($table)) {
    //print "Querying from $table<br><br>";
    $db = new MyDB();
    if ($table == 'hosts') {
        $stmt = $db->prepare('SELECT * FROM hosts');
        $results = $stmt->execute();
        print "<table border='1'>";
        print "<tr>\n\t\t\t\t<td>host_id</td>\n\t\t\t\t<td>hostname</td>\n\t\t\t\t</tr>";
        while ($row = $results->fetchArray()) {
            print "<tr>\n\t\t\t\t\t<td>" . $row['host_id'] . "</td>\n\t\t\t\t\t<td>" . $row['hostname'] . "</td>\n\t\t\t\t\t</tr>";
        }
        print "</table>";
    } else {
        if ($table == 'accelerators') {
            $stmt = $db->prepare('SELECT * FROM accelerators');
            $results = $stmt->execute();
            print "<table border='1'>";
            print "<tr>\n\t\t\t\t<td>accl_id</td>\n\t\t\t\t<td>Type</td>\n\t\t\t\t<td>Hardware Name</td>\n\t\t\t\t<td>Architecture</td>\n\t\t\t\t<td>Memory (GB)</td>\n\t\t\t\t<td>Cores</td>\n\t\t\t\t<td>Details</td>\n\t\t\t\t</tr>";
            while ($row = $results->fetchArray()) {
                print "<tr>\n\t\t\t\t\t<td>" . $row['accl_id'] . "</td>\n\t\t\t\t\t<td>" . $row['type'] . "</td>\n\t\t\t\t\t<td>" . $row['accl_name'] . "</td>\n\t\t\t\t\t<td>" . $row['arch'] . "</td>\n\t\t\t\t\t<td>" . $row['memory'] . "</td>\n\t\t\t\t\t<td>" . $row['cores'] . "</td>\n\t\t\t\t\t<td>" . $row['details'] . "</td>\n\t\t\t\t\t</tr>";
            }
开发者ID:sd-omkar,项目名称:hpc_benchmarks,代码行数:31,代码来源:get.php


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