mysql_connect

Open a connection to a MySQL Server

Syntax mysql_connect('host_name', 'user_name', 'password');

mysql_select_db

Select a MySQL database

Syntax mysql_select_db('database_name');

mysql_query

Send a MySQL query

Syntax mysql_query(query,connection);

mysql_fetch_assoc

Fetch a result row as an associative array.

Syntax array mysql_fetch_assoc (resource $result);

mysql_fetch_array

Fetch a result row as an associative array, a numeric array, or both.

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

mysql_insert_id

Get the ID generated from the previous INSERT operation.

Syntax int mysql_insert_id ([ resource $link_identifier = NULL ] );

mysql_affected_rows

Get number of affected rows in previous MySQL operation

Syntax int mysql_affected_rows ([ resource $link_identifier = NULL ] );

mysql_fetch_row

Get a result row as an enumerated array

Syntax array mysql_fetch_row (resource $result);

mysql_num_rows

Get number of rows in result

Syntax int mysql_num_rows ( resource $result );

mysql_close

Close MySQL connection

Syntax bool mysql_close ([ resource $link_identifier = NULL ] );

mysql_error

Returns the text of the error message from previous MySQL operation.

Syntax string mysql_error ([ resource $link_identifier = NULL ] );

mysql_free_result

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

Syntax mysql_free_result(resource $result);
example:
  	
			<?php
				$link = mysql_connect('host_name', 'user_name', 'password')or die('Could not connect: ' . mysql_error()); // connecting, selecting database
				echo 'Connected successfully';
				mysql_select_db('database_name') or die('Could not select database');
				$query = 'SELECT * FROM table_name';
				$result = mysql_query($query) or die('Query failed: ' . mysql_error()); // performing SQL query
				// Printing results in HTML
				echo "\n";
				while($row = mysql_fetch_assoc($result )){
				echo "\t\n";
				foreach ($row as $col_value) {
					echo "\t\t\n";
                                        echo "$col_value\n";
				}
				echo "\t\n";
				}
				
				mysql_free_result($result); // Free resultset
				mysql_close($link); // Closing connection
			?>
		
Output :
Connected successfully
mysql_num_rows : 0
mysql_fetch_row :
mysql_fetch_assoc :
id name address doj dob email phone d_date