Home Tutorial Php Phpdatabase PHP MySQLi Affected Rows

 
 

PHP MySQLi Affected Rows
Posted on: May 1, 2010 at 12:00 AM
In this current tutorial we will study how to connect PHP and MySQLi but before that we will study what is MySQLi extension in PHP.

mysqli->affected_rows:

This is a method of mysqli by which we can get the number of affected rows in the previous MySQL  operation.

There are two formats are available for this  of the method is as follows:

Object Oriented Style (property):

mysqli, int $affected_rows.

Procedural Style:

int mysqli_affected_rows(mysqli $link)

Example:

<?php

$db=new mysqli("localhost","root","","university");

if(mysqli_connect_error())

{

printf("Connect failed:%s \n",mysqli_connect_error());

exit();

}

$result=$db->query("select name from student");

printf("Affected rows:%d \n",$db->affected_rows);

Output:

Affected rows:-1

Related Tags for PHP MySQLi Affected Rows:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.