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


PHP DB::get_row方法代码示例

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


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

示例1: catalogo

function catalogo($tid, $i)
{
    $database = new DB();
    $query = "SELECT categoria_id,categoria  FROM categoria\n\t\twhere 1 ";
    $results = $database->get_results($query);
    foreach ($results as $row) {
        echo "<tr ><td colspan=3>" . $row['categoria'] . " </td></tr>";
        $query = "SELECT descuento from temporada where temporada_Id={$tid}";
        list($descuento) = $database->get_row($query);
        $query = "SELECT subcategoria_id,subcategoria  FROM subcategoria where categoria_id=" . $row['categoria_id'];
        $subs = $database->get_results($query);
        foreach ($subs as $sub) {
            $query = "SELECT count(producto_id) as productos FROM producto\n\t\t\t\t\twhere producto.temporada_id={$tid} AND subcategoria_id=" . $sub['subcategoria_id'];
            if ($i) {
                $query .= " AND producto.descuento={$descuento}";
            } else {
                $query .= " AND producto.descuento<>{$descuento}";
            }
            list($productos) = $database->get_row($query);
            if ($productos) {
                echo "<tr><td></td><td align=right>\n\t\t\t\t\t\t<a href=/index.php?data=catalogo&subcat=" . $sub['subcategoria_id'] . "&tid={$tid}>" . $sub['subcategoria'] . "</a>\n                        &nbsp;&nbsp; </td>\n\t\t\t\t\t\t<td>{$productos}</td></tr>";
            }
        }
    }
}
开发者ID:raulquintero,项目名称:speimx,代码行数:25,代码来源:promociones.src.php

示例2: get_user_localization

 /**
  * Get the userWhereIs info
  */
 function get_user_localization($user_localization_id = null, $online_time = USER_ONLINE_TIME)
 {
     if (!$user_localization_id) {
         $user_localization_id = $this->get_user_localization_id();
     }
     return DB::get_row("SELECT " . DB_PREFIX . "user.*, " . DB_PREFIX . "user_localization.*\r\n\t\t\t\t\t\t\tFROM " . DB_PREFIX . "user_localization\r\n\t\t\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "user ON " . DB_PREFIX . "user_localization.user_id = " . DB_PREFIX . "user.user_id\r\n\t\t\t\t\t\t\tWHERE ( " . TIME . " - time ) < {$online_time}\r\n\t\t\t\t\t\t\tAND user_localization_id = {$user_localization_id}");
 }
开发者ID:jffuchs,项目名称:rainframework,代码行数:10,代码来源:Rain_User_Localization.php

示例3: get

 /**
  * static function get
  * Returns a single comment, by ID
  *
  * <code>
  * $post = Post::get( 10 );
  * </code>
  *
  * @param int $id An ID
  * @return array A single Comment object
  */
 static function get($id = 0)
 {
     if (!$id) {
         return false;
     }
     return DB::get_row('SELECT * FROM {comments} WHERE id = ?', array($id), 'Comment');
 }
开发者ID:habari,项目名称:system,代码行数:18,代码来源:comment.php

示例4: get

 /**
  * static function get
  * Returns a single traffum, by ID
  *
  * @param int An ID
  * @return array A single Traffum object
  **/
 static function get($ID = 0)
 {
     if (!$ID) {
         return false;
     }
     return DB::get_row('SELECT * FROM {link_traffic} WHERE id = ?', array($ID), 'Traffum');
 }
开发者ID:habari-extras,项目名称:linkblog,代码行数:14,代码来源:linkdatabase.php

示例5: test_update_block

	public function test_update_block()
	{
		$params = array(
			'title' => $this->title,
			'type' => $this->type
		);
		$block = new Block($params);

		$block->insert();
		$block_id = $block->id;

		$updated_title = 'Updated Block Title';
		$updated_type = 'Updated Block Type';
		$block->title = $updated_title;
		$block->type = $updated_type;
		$block->update();

		$updated_block = DB::get_row('SELECT * FROM {blocks} WHERE id=:id', array('id' => $block_id), 'Block');
		$this->assert_equal( $updated_block->title, $updated_title, 'Block title should be updated' );
		$this->assert_equal( $updated_block->type, $updated_type, 'Block type should be updated' );

		// Try updating data as well
		$block->data_test = 'foo';
		$block->update();

		$updated_block = DB::get_row('SELECT * FROM {blocks} WHERE id=:id', array('id' => $block_id), 'Block');
		$this->assert_equal( $updated_block->data_test, $block->data_test, 'Block data should be updated' );

		$block->delete();
	}
开发者ID:rynodivino,项目名称:tests,代码行数:30,代码来源:test_block.php

示例6: silo_dir

 /**
  * Return contents of silo directories. This is what the publish page uses.
  *
  */
 public function silo_dir($path)
 {
     $section = strtok($path, '/');
     $results = array();
     $user = User::identify();
     // If the root is being requested, return all scratchpads for this user
     if ($section == '') {
         $scratchpads = DB::get_results('SELECT id, name, slug FROM {scratchpads} WHERE user_id = ?', array($user->id));
         foreach ($scratchpads as $scratchpad) {
             $results[] = new MediaAsset(self::SILO_NAME . '/' . $scratchpad->slug, true, array('title' => ucfirst($scratchpad->name)));
         }
     } else {
         $scratchpad = DB::get_row('SELECT id, slug, template FROM {scratchpads} WHERE slug = ? AND user_id = ?', array($section, $user->id));
         // Get a template, either this scratchpad's or the default.
         $template = '';
         if (!isset($scratchpad->template)) {
             $template = DB::get_value('SELECT template FROM {scratchpads} WHERE slug = ? AND user_id = ?', array('default', $user->id));
         } else {
             $template = $scratchpad->template;
         }
         $entries = DB::get_results('SELECT * FROM {scratchpad_entries} WHERE scratchpad_id = ?', array($scratchpad->id));
         foreach ($entries as $entry) {
             $this->entry = $entry;
             // Insert relevant parts in the template
             $output = preg_replace_callback('%\\{\\$(.+?)\\}%', array(&$this, 'replace_parts'), $template);
             $results[] = new MediaAsset(self::SILO_NAME . '/' . $scratchpad->slug . '/' . $entry->slug, false, array('filetype' => 'scratchpad', 'title' => $entry->title, 'url' => $entry->url, 'content' => $entry->content, 'output' => $output));
         }
     }
     return $results;
 }
开发者ID:habari-extras,项目名称:scratchpad,代码行数:34,代码来源:scratchpad.plugin.php

示例7: subcategorias

function subcategorias($categoria_id)
{
    $database = new DB();
    $query = "SELECT categoria  FROM categoria where categoria_id={$categoria_id} ";
    list($categoria) = $database->get_row($query);
    echo "<div class=\"box-header\">\n\t\t\t\t\t\t<h2><i class=\"halflings-icon align-justify\"></i><span class=\"break\"></span>Subcategorias de: " . strtoupper($categoria) . " </h2>\n\t\t\t\t\t\t<div class=\"box-icon\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-setting\"><i class=\"halflings-icon wrench\"></i></a>\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-minimize\"><i class=\"halflings-icon chevron-up\"></i></a>\n\t\t\t\t\t\t\t<a href=\"#\" class=\"btn-close\"><i class=\"halflings-icon remove\"></i></a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"box-content\">";
    echo "\t\t\t<form class=\"form-horizontal\" action=\"/functions/crud_proveedores.php\">\n\t\t\t\t\t\t\t<fieldset>\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<div class=\"control-group \">\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<label class=\"control-label\" for=\"subcategoria\">SubCategoria</label>\n\t\t\t\t\t\t\t\t<div class=\"controls\">\n\t\t\t\t\t\t\t\t  <input class=\"input-large\" id=\"subcategoria\" name=\"subcategoria\" type=\"text\" value=\"" . strtoupper($rfc) . "\"> \n\t\t\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-primary\">Agregar SubCategoria</button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t  </div>\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>";
    echo "<table class=\"table table-striped table-bordered \">\n\t\t\t\t\t\t\t  <thead>\n\t\t\t\t\t\t\t\t  <tr>\n\t\t\t\t\t\t\t\t\t  <th>Subcategoria</th>\n\t\t\t\t\t\t\t\t\t  <th>Productos</th>\n\t\t\t\t\t\t\t\t\t  <th>Acciones</th>\n\t\t\t\t\t\t\t\t  </tr>\n\t\t\t\t\t\t\t  </thead>   \n\t\t\t\t\t\t\t  <tbody>";
    $query = "SELECT subcategoria_id,subcategoria  FROM subcategoria where categoria_id=" . $categoria_id;
    $subs = $database->get_results($query);
    foreach ($subs as $sub) {
        $query = "SELECT count(producto_id) as productos FROM producto \n\t\t\t\t\twhere subcategoria_id=" . $sub['subcategoria_id'];
        list($productos) = $database->get_row($query);
        echo "<tr><td align=right> \n\t\t\t\t\t\t<a href=/index.php?data=catalogo&subcat=" . $sub['subcategoria_id'] . ">" . $sub['subcategoria'] . "</a>&nbsp;&nbsp; </td>\n\t\t\t\t\t\t<td>{$productos}</td></tr>";
    }
    echo "\t\t\t\t  </tbody>\n\t\t\t\t\t\t </table>     \n\t\t\t\t\t</div>\n\t\t\t\t";
}
开发者ID:raulquintero,项目名称:speimx,代码行数:17,代码来源:catalogo.src.php

示例8: get_cronjob

 /**
  * Get a Cron Job by name or id from the Database.
  *
  * @param mixed $name The name or id of the cron job to retreive.
  * @return \Habari\CronJob The cron job retreived from the DB
  */
 static function get_cronjob($name)
 {
     if (is_int($name)) {
         $cron = DB::get_row('SELECT * FROM {crontab} WHERE cron_id = ?', array($name), '\\Habari\\CronJob');
     } else {
         $cron = DB::get_row('SELECT * FROM {crontab} WHERE name = ?', array($name), '\\Habari\\CronJob');
     }
     return $cron;
 }
开发者ID:habari,项目名称:system,代码行数:15,代码来源:crontab.php

示例9: catalogo

function catalogo($proveedor_id)
{
    $database = new DB();
    $query = "SELECT categoria_id,categoria  FROM categoria \n\t\twhere 1 ";
    $results = $database->get_results($query);
    foreach ($results as $row) {
        echo "<tr >\n\t\t\t<td><font >" . $row['categoria'] . " </td>\n\t\t\t<td><font > </td>\n\t\t\t<td><font > </td>\n\t\t\t<td><font > </td>\n\t\t\t<td><font > </td>\n\t\t\t</tr>";
        $query = "SELECT subcategoria_id,subcategoria  FROM subcategoria where categoria_id=" . $row['categoria_id'];
        $subs = $database->get_results($query);
        foreach ($subs as $sub) {
            $query = "SELECT MIN(precio_compra) as precio_min,MAX(precio_compra) as precio_max FROM producto \n\t\t\t\t\t\twhere subcategoria_id=" . $sub['subcategoria_id'] . " AND proveedor_id={$proveedor_id}";
            list($precio_min, $precio_max) = $database->get_row($query);
            $query = "SELECT count(producto_id) as productos FROM producto \n\t\t\t\t\twhere subcategoria_id=" . $sub['subcategoria_id'] . " AND proveedor_id={$proveedor_id}";
            list($productos) = $database->get_row($query);
            echo "<tr><td></td><td align=right> \n\t\t\t\t\t\t<a href=/index.php?data=proveedores&op=detalles&pid={$proveedor_id}&subcat=" . $sub['subcategoria_id'] . ">" . $sub['subcategoria'] . "</a>&nbsp;&nbsp; </td>\n\t\t\t\t\t\t<td>{$productos}</td><td style='text-align:right'>" . dinero($precio_min) . "</td><td style='text-align:right'>" . dinero($precio_max) . "</td></tr>";
        }
    }
}
开发者ID:raulquintero,项目名称:speimx,代码行数:18,代码来源:proveedores_detalles.scr.php

示例10: getGroupInfo

 public static function getGroupInfo($groupid)
 {
     $groupid = DB::escape($groupid);
     $query = 'SELECT * FROM ' . TABLE_PREFIX . 'groups WHERE ';
     if (is_numeric($groupid)) {
         $query .= 'id=' . $groupid;
     } else {
         $query .= 'name=\'' . $groupid . '\'';
     }
     return DB::get_row($query);
 }
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:11,代码来源:UserGroups.class.php

示例11: GetPilotAward

    /**
     * Get the specific award of a pilot, mainly to see if they have it
     *
     * @param int $pilotid Pilot ID
     * @param int $awardid Award ID
     * @return array Row of the award
     *
     */
    public static function GetPilotAward($pilotid, $awardid)
    {
        $pilotid = intval($pilotid);
        $awardid = intval($awardid);
        $sql = 'SELECT g.id, g.pilotid, a.*
					FROM ' . TABLE_PREFIX . 'awardsgranted g
					INNER JOIN ' . TABLE_PREFIX . 'awards a ON a.awardid=g.awardid
					WHERE g.`pilotid`=' . $pilotid . '
						AND g.`awardid`=' . $awardid;
        return DB::get_row($sql);
    }
开发者ID:deanstalker,项目名称:phpVMS,代码行数:19,代码来源:AwardsData.class.php

示例12: check_hoursdiff

    public static function check_hoursdiff($name, $age_hours)
    {
        $name = strtoupper($name);
        $sql = 'SELECT `lastupdate`
				FROM ' . TABLE_PREFIX . "updates\n\t\t\t\tWHERE DATE_SUB(CURDATE(), INTERVAL {$age_hours} HOUR) <= lastupdate\n\t\t\t\t\tAND name='{$name}'";
        $row = DB::get_row($sql);
        if (!$row) {
            return false;
        }
        return true;
    }
开发者ID:deanstalker,项目名称:phpVMS,代码行数:11,代码来源:CronData.class.php

示例13: content_query

 private function content_query($format, $params)
 {
     //basic content query for id
     if (isset($params['id'])) {
         $field = array($params['id']);
         //initial test query for single row content
         $db_content = DB::get_row("SELECT contenttext FROM content WHERE contentid=?", $field);
         $db_content = $db_content['contenttext'];
     }
     self::$default_content = $db_content;
 }
开发者ID:csteach402,项目名称:source,代码行数:11,代码来源:content.php

示例14: save_cached_price

 /**
  * Save the fuel price in our local cache so the api
  *  server won't get hammered
  *
  * @param object $xmlObj The object with the fuel data
  * @return mixed This is the return value description
  *
  */
 protected static function save_cached_price($xmlObj)
 {
     $query = "SELECT * \n\t\t\t\t\tFROM `" . TABLE_PREFIX . "fuelprices`\n\t\t\t\t\tWHERE `icao`='{$xmlObj->icao}'";
     $res = DB::get_row($query);
     if ($res) {
         $query = "UPDATE `" . TABLE_PREFIX . "fuelprices`\n\t\t\t\t\t\tSET `icao`='{$xmlObj->icao}', \n\t\t\t\t\t\t\t`lowlead`='{$xmlObj->lowlead}', \n\t\t\t\t\t\t\t`jeta`='{$xmlObj->jeta}', \n\t\t\t\t\t\t\tdateupdated=NOW()\n\t\t\t\t\t\tWHERE `id`={$res->id}";
     } else {
         $query = "INSERT INTO `" . TABLE_PREFIX . "fuelprices`\n\t\t\t\t\t\t\t(`icao`, \n\t\t\t\t\t\t\t `lowlead`, \n\t\t\t\t\t\t\t `jeta`,\n\t\t\t\t\t\t\t `dateupdated`)\n\t\t\t\t\t\tVALUES ('{$xmlObj->icao}', \n\t\t\t\t\t\t\t\t'{$xmlObj->lowlead}', \n\t\t\t\t\t\t\t\t'{$xmlObj->jeta}', \n\t\t\t\t\t\t\t\tNOW())";
     }
     DB::query($query);
 }
开发者ID:rallin,项目名称:phpVMS,代码行数:19,代码来源:FuelData.class.php

示例15: read

 /**
  * Read session data from the database to return into the $_SESSION global.
  * Verifies against a number of parameters for security purposes.
  *
  * @param string $session_id The id generated by PHP for the session.
  * @return string The retrieved session.
  */
 static function read($session_id)
 {
     // for offline testing
     $remote_address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
     // not always set, even by real browsers
     $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $session = DB::get_row('SELECT * FROM {sessions} WHERE token = ?', array($session_id));
     // Verify session exists
     if (!$session) {
         self::$initial_data = false;
         return false;
     }
     $dodelete = false;
     if (!defined('SESSION_SKIP_SUBNET') || SESSION_SKIP_SUBNET != true) {
         // Verify on the same subnet
         $subnet = self::get_subnet($remote_address);
         if ($session->subnet != $subnet) {
             $dodelete = true;
         }
     }
     // Verify expiry
     if (HabariDateTime::date_create(time())->int > $session->expires) {
         Session::error(_t('Your session expired.'), 'expired_session');
         $dodelete = true;
     }
     // Verify User Agent
     if ($user_agent != $session->ua) {
         $dodelete = true;
     }
     // Let plugins ultimately decide
     $dodelete = Plugins::filter('session_read', $dodelete, $session, $session_id);
     if ($dodelete) {
         $sql = 'DELETE FROM {sessions} WHERE token = ?';
         $args = array($session_id);
         $sql = Plugins::filter('sessions_clean', $sql, 'read', $args);
         DB::query($sql, $args);
         return false;
     }
     // Do garbage collection, since PHP is bad at it
     $probability = ini_get('session.gc_probability');
     // Allow plugins to control the probability of a gc event, return >=100 to always collect garbage
     $probability = Plugins::filter('gc_probability', is_numeric($probability) && $probability > 0 ? $probability : 1);
     if (rand(1, 100) <= $probability) {
         self::gc(ini_get('session.gc_maxlifetime'));
     }
     // Throttle session writes, so as to not hammer the DB
     self::$initial_data = ini_get('session.gc_maxlifetime') - $session->expires + HabariDateTime::date_create(time())->int < 120 ? $session->data : FALSE;
     return $session->data;
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:56,代码来源:session.php


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