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


PHP MyDB::lastInsertRowID方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: insert_item

function insert_item($title, $descr, $photos)
{
    $db = new MyDB();
    if (!$db) {
        echo $db->lastErrorMsg();
    }
    $sql = "INSERT INTO item (title, description) VALUES ('{$title}','{$descr}')";
    $ret = $db->exec($sql);
    $itemID = $db->lastInsertRowID();
    foreach ($photos as $photo) {
        $sql = "INSERT INTO photo (name, item_id) VALUES ('{$photo}','{$itemID}')";
        $ret = $db->exec($sql);
    }
    if (!$ret) {
        echo $db->lastErrorMsg();
    }
}
开发者ID:SerebryanskiySergei,项目名称:artduet,代码行数:17,代码来源:db.php

示例5: 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


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