Mysqli fetch object - MySQL - PHP MySQL Display - Phptpoint.com

mysqli_fetch_object

Best PHP Training with Live Project in Noida Fee is only 7500/-Click here for FREE DEMO.

/ins>

Fetch data using mysqli_fetch_object( ) function

The mysqli_fetch_object() function returns a row from a recordset as an object.

mysqli_fetch_object() return the rows from the number of records available in the database as an object.

at a time it return only the first row as an object. if we want to retrieve all the records of the table then we must put this function inside the while loop.

Syntax

Display the records using mysqli_fetch_object()

In the above example first connection to the database is created after that the result provided by mysqli_query() is passed to mysqli_fetch_object() and object returned is stored in row variable. the data of the object is displayed .

Retrieve all records from empInfo table using mysqli_fetch_object( ) function.

Output :

Emp_idNameEmailMobile
1deveshdevesh@gmail.com9910099100
2deepakdeepak@gmail.com9210053520
3raviravi@gmail.com9810098100

In the above example first connection to the database is created after that the result provided by mysqli_query() is passed to mysqli_fetch_object() and object returned is stored in row variable and it put in while loop to fetch all records . after that the data is displayed in tabular form.

Keep Updating yourself