PHP uses Mysql_fetch_object to get the object set from the query results, mysqlfetchobject_php tutorial

Source: Internet
Author: User

PHP uses Mysql_fetch_object to get the set of objects from the query results, Mysqlfetchobject


This example describes how PHP uses Mysql_fetch_object to get the set of objects from the query results. Share to everyone for your reference. The specific analysis is as follows:

The Mysql_fetch_object function is used to extract the result line from a MySQL result set as an objectiative array.

Mysql_fetch_object Syntax:

Array mysql_fetch_object (Resource $Result _set)

The Result_set handle returns a mysql_query query result set.
If execution successfully returns an object containing all data rows, returns a bool value if it fails

Here is the demo code:

<?php$username = ' abc '; $Password = ' 1234 '; $DbHandle = mysql_connect (' localhost ', $UserName, $Password); if (!$ Dbhandle) {die ' No database connection could is established. ';} $DBName = ' W3db;if (!mysql_select_db ($DBName, $DbHandle)) {die ' Database could not being selected. ';} $Query = "Select ISBN, Title, Author from articles"; $articles = mysql_query ($Query, $DbHandle)) and while ($Row = Mysql_fetch _object ($articles)) {echo "ISBN = $Row->ISBN
\ n "; echo "Title = $Row->title
\ n "; echo "Author = $Row->author
\ n ";}?" >

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/969478.html www.bkjia.com true http://www.bkjia.com/PHPjc/969478.html techarticle PHP uses Mysql_fetch_object to get the set of objects from the query results, Mysqlfetchobject This example describes how PHP uses Mysql_fetch_object to get the set of objects from the query results. ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.