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


PHP MySQL::fetchRow方法代码示例

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


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

示例1: read

 /**
  * Given the hash of a some data, check to see whether it exists in
  * `tbl_cache`. If no cached object is found, this function will return
  * false, otherwise the cached object will be returned as an array.
  *
  * @param string $hash
  *  The hash of the Cached object, as defined by the user
  * @return array|boolean
  *  An associative array of the cached object including the creation time,
  *  expiry time, the hash and the data. If the object is not found, false will
  *  be returned.
  */
 public function read($hash)
 {
     if ($c = $this->Database->fetchRow(0, "SELECT SQL_NO_CACHE * FROM `tbl_cache` WHERE `hash` = '{$hash}' AND (`expiry` IS NULL OR UNIX_TIMESTAMP() <= `expiry`) LIMIT 1")) {
         if (!($c['data'] = Cacheable::decompressData($c['data']))) {
             $this->delete($hash);
             return false;
         }
         return $c;
     }
     $this->delete();
     return false;
 }
开发者ID:valery,项目名称:symphony-2,代码行数:24,代码来源:cache.database.php

示例2: read

 /**
  * Given the hash of a some data, check to see whether it exists in
  * `tbl_cache`. If no cached object is found, this function will return
  * false, otherwise the cached object will be returned as an array.
  *
  * @param string $hash
  *  The hash of the Cached object, as defined by the user
  * @param string $namespace
  *  The namespace allows a group of data to be retrieved at once
  * @return array|boolean
  *  An associative array of the cached object including the creation time,
  *  expiry time, the hash and the data. If the object is not found, false will
  *  be returned.
  */
 public function read($hash, $namespace = null)
 {
     $data = false;
     // Check namespace first
     if (!is_null($namespace)) {
         $data = $this->Database->fetch("\n                SELECT SQL_NO_CACHE *\n                FROM `tbl_cache`\n                WHERE `namespace` = '{$namepspace}'\n                AND (`expiry` IS NULL OR UNIX_TIMESTAMP() <= `expiry`)\n            ");
     }
     // Then check hash
     if (!is_null($hash)) {
         $data = $this->Database->fetchRow(0, "\n                SELECT SQL_NO_CACHE *\n                FROM `tbl_cache`\n                WHERE `hash` = '{$hash}'\n                AND (`expiry` IS NULL OR UNIX_TIMESTAMP() <= `expiry`)\n                LIMIT 1\n            ");
     }
     // If the data exists, see if it's still valid
     if ($data) {
         if (!($data['data'] = Cacheable::decompressData($data['data']))) {
             $this->delete($hash, $namespace);
             return false;
         }
         return $data;
     }
     $this->delete(null, $namespace);
     return false;
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:36,代码来源:cache.database.php

示例3: resolvePage

 /**
  * Given the `$page_id` and a `$column`
  *
  * @param mixed $page_id
  * The ID of the Page that currently being viewed, or the handle of the
  * current Page
  * @return array
  * An array of the current Page, containing the `$column`
  * requested. The current page will be the last item the array, as all
  * parent pages are prepended to the start of the array
  */
 public function resolvePage($page_id, $column)
 {
     $path = array();
     $page = self::$Database->fetchRow(0, "\n\t\t\t\tSELECT\n\t\t\t\t\tp.{$column},\n\t\t\t\t\tp.parent\n\t\t\t\tFROM\n\t\t\t\t\t`tbl_pages` AS p\n\t\t\t\tWHERE\n\t\t\t\t\tp.id = '{$page_id}'\n\t\t\t\t\tOR p.handle = '{$page_id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     $path = array($page[$column]);
     if (!is_null($page['parent'])) {
         $next_parent = $page['parent'];
         while ($parent = self::$Database->fetchRow(0, "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\tp.{$column},\n\t\t\t\t\t\t\tp.parent\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_pages` AS p\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tp.id = '{$next_parent}'\n\t\t\t\t\t")) {
             array_unshift($path, $parent[$column]);
             $next_parent = $parent['parent'];
         }
     }
     return $path;
 }
开发者ID:scottkf,项目名称:keepflippin--on-symphony,代码行数:25,代码来源:class.symphony.php

示例4: die

    if (!$newresults) {
        die('Error building database!' . $sql);
    }
}
//get supplier from categories
// print"<br>";
for ($i = 1; $i < $num_rec; $i++) {
    $sql = "SELECT supplier FROM hkmatrix WHERE uid = " . $i;
    $results = $db->QuerySingleRowArray($sql);
    $suppcode = $results[0];
    if ($suppcode) {
        $sql2 = "SELECT hksupplier, wwwsupplier FROM categories WHERE code = '" . $suppcode . "'";
        //print $sql2."<br>";
        $subresults = $db->Query($sql2);
        if (!empty($subresults)) {
            $ns = $db->fetchRow($subresults);
            //print_r($ns);
            if ($ns[1]) {
                $newsupp = $db->clean($ns[1]);
            } else {
                $newsupp = $db->clean($ns[0]);
            }
            $sql3 = "UPDATE hkmatrix SET supplier ='" . $newsupp . "' WHERE uid = " . $i;
            //print "<br> $sql3";
            $results = $db->Query($sql3);
        }
    }
    //finish suppcode check
    $sql = "SELECT prodgroup FROM hkmatrix WHERE uid = " . $i;
    $results = $db->QuerySingleRowArray($sql);
    $pgcode = $results[0];
开发者ID:onyxnz,项目名称:quartzpos,代码行数:31,代码来源:matrixread.php

示例5: explode

             $db_insertid = $db->insertID();
             $urlex = '/\\b(([^:\\/?#]+):)(\\/\\/([^\\/?#]*))([^?#]*)(\\?([^#]*))?(#(.*))?/i';
             $contentArray = explode(" ", $status);
             $linkArray = array();
             foreach ($contentArray as $content) {
                 if (preg_match($urlex, $content, $matches)) {
                     array_push($linkArray, $matches);
                 }
             }
             foreach ($linkArray as $link) {
                 if ($link[4] != "" && strlen($link[4]) > 3) {
                     $db->query('SELECT * FROM stream WHERE type = 4 AND data = "' . mysql_real_escape_string($link[0]) . '"');
                     if ($db->numRows() == 0) {
                         $db->insert('stream', array('timestamp' => time(), 'type' => 4, 'data' => $link[0], 'likes' => 1));
                     } else {
                         $oid = $db->fetchRow();
                         $db->query('UPDATE stream SET likes = likes+1 WHERE sid = ' . $oid);
                     }
                 }
             }
             $final = array("data" => array("insertid" => $db_insertid, "status" => addslashes($status)), "error" => false);
             print_r(json_encode($final));
         } else {
             die('0');
         }
     } catch (Exception $e) {
         echo $e->getMessage();
         exit;
     }
 } elseif ($_POST['p'] == 'updatestatus') {
     try {
开发者ID:Gerst20051,项目名称:Social-HnS,代码行数:31,代码来源:ajax.php

示例6: MySQL

<?php /* Logged In Get Request */
if (isset($_GET['p'])) {

if ($_GET['p'] == 'userdata') {
try {
	$db = new MySQL();
	if (!isset($_GET['uid'])) $uid = $_SESSION['user_id'];
	else $uid = $_GET['uid'];
	$db->query();
	if ($db->numRows() == 1) {
		header('Content-Type: text/javascript; charset=utf8');
		print_r(json_encode($db->fetchRow()));
	} else die('0');
} catch(Exception $e) {
	echo $e->getMessage();
	exit();
}
}

}
?>
开发者ID:Gerst20051,项目名称:HnS-Framework,代码行数:21,代码来源:ajax.inget.inc.php.php


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