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


PHP Connection::fetch方法代码示例

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


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

示例1: get

	/**
	 * Returns rows from database.
	 * @param string $query
	 * @param array $params
	 * @param int $limit
	 * @param int $offset
	 * @return array
	 */
	public function get($query, array $params = array(), $limit = false, $offset = 0) {
		if ($limit) {
			$query = $this->strategy->limit($query, $limit, $offset);
		}
		$return = array();
		$result = $this->connection->query($query, $params);
		if ($result) {
			while ($row = $this->connection->fetch($result)) {
				$return[] = $row;
			}
		}
		return $return;
	}
开发者ID:renq,项目名称:ML-Lib,代码行数:21,代码来源:SQL.php

示例2: testFetchEOF

 public function testFetchEOF()
 {
     $this->createTable();
     $statement = $this->connection->query("SELECT * FROM cat");
     $this->connection->fetch($statement);
     // Simon's Cat
     $this->connection->fetch($statement);
     // Garfield
     $this->assertFalse($this->connection->fetch($statement));
 }
开发者ID:renq,项目名称:Simqel,代码行数:10,代码来源:PDOTest.php

示例3: mysql_num_rows

<?php

include 'db_connect.php';
//include the db_connect.php file
//Create and set a new connection
$get = new Connection("db1");
//"db1" is user defined in db_connect.php
//Create a query: $var->query("SQL_STATEMENT"); $var is the variable you created a connection with.
$selectusers = $get->query("SELECT * FROM users");
//Do whatever you would like with the query
echo mysql_num_rows($selectusers);
//Use built in functions to make one line queries.
echo $get->fetch($selectusers);
//fetch() fetches the associated rows.  More quick functions coming soon.
开发者ID:njmube,项目名称:Easy-PHP-MySQL,代码行数:14,代码来源:example.php

示例4: getFullDate

//Declaring $sameDate as an array.
if ($db->numRows($result) < 1) {
    //Checking if the result is smaller then 1.
    echo '<li class="day">';
    echo "<h4>" . getFullDate($date) . "<a href=\"#\" onClick=\"nextDate('{$date}')\" class=\"todoNav\">Next</a><a href=\"#\" onClick=\"previousDate('{$date}')\" class=\"todoNav\">Previous </a> </h4>";
    //Returns the date as a String.
    echo '<fieldset>';
    echo '<input class="ToDoInsert" type="text" value="Insert your ToDo here and hit the enter-key." name="ToDoInsert" />';
    echo '</fieldset>';
    echo '<ul>';
    echo '</ul>';
    echo '</li>';
    //End Of This Day.
} else {
    //Displaying the result.
    while ($row = $db->fetch($result)) {
        if (!in_array($row['todo_date'], $sameDate)) {
            echo '<li class="day">';
            echo "<h4>" . getFullDate($date) . "<a href=\"#\" onClick=\"nextDate('{$date}')\" class=\"todoNav\">Next</a><a href=\"#\" onClick=\"previousDate('{$date}')\" class=\"todoNav\">Previous </a> </h4>";
            //Returns the date as a String.
            echo '<fieldset>';
            echo '<input class="ToDoInsert" type="text" value="Insert your ToDo here and hit the enter-key." name="ToDoInsert" />';
            echo '</fieldset>';
            echo '<ul>';
            $resultList = $db->query('SELECT * FROM th_todo WHERE todo_userId = ' . $_SESSION['user']['id'] . ' AND `todo_date` =  "' . $row['todo_date'] . '"');
            while ($rowWhile = $db->fetch($resultList)) {
                echo '<li>';
                //Resetting the $done var.
                $done = '';
                if ($rowWhile['todo_done'] == 1) {
                    $done = 'done';
开发者ID:KrisTemmerman,项目名称:Threads,代码行数:31,代码来源:dash-todo.php

示例5: oneAsArray

 /**
  * @param array $columnsToSelect
  * @return array|null
  */
 public function oneAsArray($columnsToSelect = ['*'])
 {
     $this->limit(1);
     return $this->connection->fetch($this->getSelectQuery($columnsToSelect), $this->getBindingValues());
 }
开发者ID:serendip811,项目名称:patio42,代码行数:9,代码来源:QueryBuilder.php

示例6: Connection

 * @version 0.2
 * @description Threads Login File
 * @author Joeri Hermans
 * @contact joeri.her@gmail.com
 * @license GNU
 */
require_once '../system/config.php';
require_once '../system/rewrite.php';
require_once '../system/classes.php';
$db = new Connection();
if (!empty($_SESSION['user']['username']) && !empty($_SESSION['user']['password'])) {
    $result = $db->query('SELECT * FROM th_users WHERE user_username = "' . $_SESSION['user']['username'] . '" AND user_password = "' . $_SESSION['user']['password'] . '"');
    //Retrieving result from MySQL
    if (mysql_num_rows($result) == 1) {
        //If MySQL returns 1 row.
        while ($row = $db->fetch($result)) {
            //You spin my head round baby round round.
            $_SESSION['user']['id'] = $row['user_id'];
            //Fetching User Id.
            $_SESSION['user']['name'] = $row['user_name'];
            //Fetching User Name.
            $_SESSION['user']['lastName'] = $row['user_lastName'];
            //Fetching User Lastname.
            $_SESSION['user']['perm'] = $row['user_permission'];
            //Fetching the users' permission.
        }
    }
}
if (isset($_POST['username'])) {
    $result = $db->query('SELECT * FROM th_users WHERE user_username = "' . $_POST['username'] . '" AND user_password = "' . md5($_POST['password']) . '"');
    if (mysql_num_rows($result) == 1) {
开发者ID:KrisTemmerman,项目名称:Threads,代码行数:31,代码来源:index.php

示例7: mysql_num_rows

<?php

include 'db_connect.php';
//include the db_connect.php file
print "<HTML><BODY><H1>Showing the users of the sampledb that has been created in the RDS few seconds ago!</H1>\n";
//Create and set a new connection
$get = new Connection("db1");
//"db1" is user defined in db_connect.php
//Create a query: $var->query("SQL_STATEMENT"); $var is the variable you created a connection with.
$selectusers = $get->query("SELECT * FROM users");
//Do whatever you would like with the query
print "Total Number of user records: ";
print mysql_num_rows($selectusers);
print "\n\r";
//Use built in functions to make one line queries.
$rowarray = $get->fetch($selectusers);
//fetch() fetches the associated rows.
print "<table>\n\r";
foreach ($rowarray as $row) {
    print "<tr>\n\r";
    foreach ($row as $col) {
        print "\t<td>{$col}</td>\n\r";
    }
    print "</tr>\n\r";
}
print "</table></BODY></HTML>";
开发者ID:herotest,项目名称:Easy-PHP-MySQL,代码行数:26,代码来源:index.php


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