Home Tutorial Php Phpdatabase PHP MySQLi Query

 
 

Share on Google+Share on Google+
PHP MySQLi Query
Posted on: May 1, 2010 at 12:00 AM
Advertisement
In the current tutorial we will study how to make query in mysqli, the example will make the concept more clear.

mysqli::query

It performs a query in specified database, the format is as follows:

Object Oriented Style:

mixed mysqli::query ( string $query [, int $resultmode ] )

Procedural Style:

mixed mysqli_query ( mysqli $link , string $query [, int $resultmode ] )

There are three parameters are present in it, link, query and resultmode.

In the example below though it is similar to previous example, but to maintain the ease of understand we put the same example.

Example:

<?php

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

if(mysqli_connect_error())

{

printf("Connection 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

Advertisement

Related Tags for PHP MySQLi Query:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: May 1, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com