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


PHP sqlite_fetch_array函数代码示例

本文整理汇总了PHP中sqlite_fetch_array函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_fetch_array函数的具体用法?PHP sqlite_fetch_array怎么用?PHP sqlite_fetch_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get

function get($db)
{
    // takes all records from database
    $result = sqlite_query($db, 'SELECT * FROM users');
    $users = array();
    while ($user = sqlite_fetch_array($result)) {
        $users[] = $user;
    }
    // generate json
    $json = array();
    for ($i = 0; $i < count($users); $i++) {
        $rec = "{";
        $rec .= 'id: "' . $users[$i]['id'] . '",';
        $rec .= 'name: "' . $users[$i]['name'] . '",';
        $rec .= 'age: "' . $users[$i]['age'] . '",';
        $rec .= 'group: "' . $users[$i]['group_name'] . '",';
        $rec .= 'city: "' . $users[$i]['city'] . '",';
        $rec .= 'phone: "' . $users[$i]['phone'] . '",';
        $rec .= 'sex: "' . $users[$i]['sex'] . '",';
        $rec .= 'driver_license: "' . $users[$i]['driver_license'] . '"';
        $rec .= "}";
        $json[] = $rec;
    }
    $json = '[' . implode(',', $json) . ']';
    return $json;
}
开发者ID:mudassartufail,项目名称:dhtmlx,代码行数:26,代码来源:data.php

示例2: check_if_exists

function check_if_exists($cc)
{
    $result = safe_query("SELECT id FROM country_data WHERE cc_code_2='{$cc}'");
    $data = sqlite_fetch_array($result, SQLITE_NUM);
    // return the id or NULL if no data is avaliable
    return $data ? $data[0] : NULL;
}
开发者ID:SandyS1,项目名称:presentations,代码行数:7,代码来源:database_pop8.php

示例3: query

function query($db, $sql)
{
    $arr = array();
    if (IS_SQLITE3) {
        $rs = $db->query($sql);
        $len = $rs->numColumns();
        while ($row = $rs->fetchArray()) {
            $tmpArr = array();
            for ($i = 0; $i < $len; $i++) {
                $tmpArr[$i] = iconv("gb2312", "UTF-8", $row[$i]);
            }
            array_push($arr, $tmpArr);
        }
    } else {
        $rs = sqlite_query($db, $sql, SQLITE_NUM);
        //echo "<font color='red'>".$error."</font>";
        while ($row = sqlite_fetch_array($rs)) {
            $tmp = array();
            for ($i = 0; $i < count($row); $i++) {
                $tmp[$i] = iconv("gb2312", "UTF-8", $row[$i]);
            }
            array_push($arr, $tmp);
        }
    }
    return $arr;
}
开发者ID:nofastfat,项目名称:nofastfat-mobile,代码行数:26,代码来源:connection.php

示例4: read

 /**
  * This function advances the reader to the next record.
  *
  * @access public
  * @override
  * @return boolean                          whether another record was fetched
  */
 public function read()
 {
     if ($this->command !== NULL) {
         $this->record = @sqlite_fetch_array($this->command, SQLITE_ASSOC);
     }
     return $this->record !== FALSE;
 }
开发者ID:ruslankus,项目名称:invoice-crm,代码行数:14,代码来源:Standard.php

示例5: next

 /**
  * Iterator function. Returns a rowset if called without parameter,
  * the fields contents if a field is specified or FALSE to indicate
  * no more rows are available.
  *
  * @param   string field default NULL
  * @return  var
  */
 public function next($field = NULL)
 {
     if (!is_resource($this->handle) || FALSE === ($row = sqlite_fetch_array($this->handle, SQLITE_ASSOC))) {
         return FALSE;
     }
     foreach (array_keys($row) as $key) {
         if (NULL === $row[$key] || !isset($this->fields[$key])) {
             continue;
         }
         switch ($row[$key][0]) {
             case "":
                 $row[$key] = Date::fromString(substr($row[$key], 1));
                 break;
             case "":
                 $row[$key] = intval(substr($row[$key], 1));
                 break;
             case "":
                 $row[$key] = floatval(substr($row[$key], 1));
                 break;
         }
     }
     if ($field) {
         return $row[$field];
     } else {
         return $row;
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:35,代码来源:SQLiteResultSet.class.php

示例6: fetch_array

 function fetch_array($sql = "")
 {
     if ($sql == "") {
         $sql = $this->query_id;
     }
     $this->record_row = @sqlite_fetch_array($sql, SQLITE_ASSOC);
     return $this->record_row;
 }
开发者ID:rust1989,项目名称:edit,代码行数:8,代码来源:db_sqlite.php

示例7: db_fetch_array

function db_fetch_array($res, $type = SQLITE_ASSOC)
{
    $t = array();
    while ($r = sqlite_fetch_array($res, $type)) {
        $t[] = $r;
    }
    return $t;
}
开发者ID:vulnerabilityCode,项目名称:ctf,代码行数:8,代码来源:sqlite.inc.php

示例8: read

 public static function read($id)
 {
     $t = time();
     $sql = "SELECT data FROM sess WHERE expire > {$t} AND id = '" . sqlite_escape_string($id) . "'";
     $r = sqlite_query($sql, SESSION_DB_LINK);
     $d = sqlite_fetch_array($r);
     return '' . is_array($d) ? array_shift($d) : false;
 }
开发者ID:laiello,项目名称:php-garden,代码行数:8,代码来源:session.php

示例9: fetchAll

 /**
  * Fetches all the results
  * @return array
  */
 function fetchAll()
 {
     $result = array();
     while ($row = sqlite_fetch_array($this->query)) {
         $result[] = $row;
     }
     return $result;
 }
开发者ID:jensz12,项目名称:PHP-Last.fm-API,代码行数:12,代码来源:SqliteResult.php

示例10: fetch

 public function fetch()
 {
     $hRow = sqlite_fetch_array($this->oRes);
     if ($this->sClass && $hRow) {
         return Model::get_instance($this->sClass, $hRow);
     }
     return $hRow;
 }
开发者ID:poitch,项目名称:dokin,代码行数:8,代码来源:SQLiteDBResult.php

示例11: fetchArray

 function fetchArray($sql)
 {
     $this->error = "";
     if ($this->versi == 3) {
         return $sql->fetchArray();
     } else {
         return sqlite_fetch_array($sql, SQLITE_ASSOC);
     }
 }
开发者ID:HuiZone,项目名称:Waruga,代码行数:9,代码来源:sqlite.php

示例12: db_driver_result

/**
 * Get the result from the database.
 *
 * @param resource $resource
 *
 * @return array
 */
function db_driver_result($resource)
{
    global $_db;
    $results = array();
    while ($data = sqlite_fetch_array($resource, SQLITE_ASSOC)) {
        $results[] = $data;
    }
    return $results;
}
开发者ID:refirio,项目名称:levis,代码行数:16,代码来源:db_sqlite.php

示例13: vdict_get

function vdict_get($db, $word)
{
    if ($db instanceof PDO) {
        $res = $db->query('SELECT * FROM dict WHERE word = ' . $db->quote($word));
        return $res->fetch();
    }
    $res = sqlite_query($db, "SELECT * FROM dict WHERE word = '{$word}'");
    return sqlite_fetch_array($res);
}
开发者ID:n2i,项目名称:xvnkb,代码行数:9,代码来源:vdict.php

示例14: getOneRecord

 function getOneRecord()
 {
     $record = new lmbSqliteRecord();
     $queryId = $this->connection->execute($this->getSQL());
     $values = sqlite_fetch_array($queryId, SQLITE_ASSOC);
     if (is_array($values)) {
         $record->import($values);
         return $record;
     }
 }
开发者ID:knevcher,项目名称:limb,代码行数:10,代码来源:lmbSqliteQueryStatement.class.php

示例15: next

 function next()
 {
     $ret = FALSE;
     if ($this->hasNext()) {
         $this->current = sqlite_fetch_array($this->id, $this->mode);
         $this->row++;
         $ret = $this->current();
     }
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:10,代码来源:sqlite.php


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