mysqli_connect

Open a connection to a MySQL Server in php5

Syntax mysqli_connect(host_name,user_name,password,db_name,port,socket);

mysqli_select_db

Change the default database for the connection in php5

Syntax mysqli_select_db(connection,db_name);

mysqli_query

Send a MySQL query in php5 or Perform queries against the database in php5

Syntax mysqli_query(connection,query,resultmode);

mysqli_fetch_assoc

Fetch a result row as an associative array in php5.
Note: Fieldnames returned from this function are case-sensitive.

Syntax array mysqli_fetch_assoc(resource $result);

mysqli_fetch_array

Fetch a result row as an associative array, a numeric array, or both in php5.
Note: Fieldnames returned from this function are case-sensitive.

Syntax array mysqli_fetch_array ( resource $result [, int result_type]);

mysqli_insert_id

Get the ID generated from the previous INSERT operation or Returns the id (generated with AUTO_INCREMENT) used in the last query in php5.

Syntax int mysqli_insert_id(connection);

mysqli_affected_rows

Get the number of affected rows in the previous SELECT, INSERT, UPDATE, REPLACE, or DELETE query in php5.

Syntax int mysqli_affected_rows(connection);

mysqli_fetch_row

Get one row from a result-set and returns it as an enumerated array in php5 .

Syntax array mysqli_fetch_row(resource $result);

mysqli_num_rows

Get number of rows in result in php5.

Syntax int mysqli_num_rows( resource $result );

mysqli_close

Close a previously opened database connection in php5 .

Syntax bool mysqli_close(connection);

mysqli_error

Returns a string with the error description from previous MySQL operation in php5. "" if no error occurred.

Syntax string mysqli_error(connection);

mysqli_connect_errno

Return an error code from the last connection error, if any in php5.Zero if no error occurred.

Syntax mysqli_connect_errno(connection);

mysqli_free_result

Fetch rows from a result-set, then free the memory associated with the result in php5. No return value.

Syntax mysqli_free_result(resource $result);
example:
  	
			<?php
				$link = mysqli_connect('host_name', 'user_name', 'password','db_name') or die('Could not connect: ' . mysqli_error());
                                echo 'Connected successfully';
                                if(mysqli_connect_errno($link)){
                                    echo "Failed to connect to MySQL: " . mysqli_connect_error();
                                }
				mysqli_select_db('database_name') or die('Could not select database');      //changing the default database
				$query = 'SELECT * FROM table_name';
				$result = mysqli_query($link,$query)  or die('Query failed: ' . mysqli_error()); // performing SQL query
				// Printing results in HTML
				echo "\n";
				while($row = mysqli_fetch_assoc($result )){
				echo "\t\n";
				foreach ($row as $col_value) {
					echo "\t\t\n";
                                        echo "$col_value\n";
				}
				echo "\t\n";
				}
				
				mysqli_free_result($result); // Free resultset
				mysqli_close($link); // Closing connection
			?>
		
Output :
Connected successfully
mysqli_num_rows : 0
mysqli_fetch_row :
mysqli_fetch_assoc :
id name address doj dob email phone d_date