It returns the error description of the last MySQL operation
Example
<?php
$conn = mysql_connect(“localhost”, “root”, “password”) or die(mysql_error());
?>
It returns the error description of the last MySQL operation
Example
<?php
$conn = mysql_connect(“localhost”, “root”, “password”) or die(mysql_error());
?>
It returns the error number of the last MySQL operation
Example
<?php
$conn = mysql_connect(“localhost”, “root”, “password”) or die(mysql_errno());
?>
Its Deprecated. .Sends a MySQL query
It delete the databse . Its depricated
It returns database name from the call to mysql_list_dbs()
Example
<?php
$conn = mysql_connect(“localhost”, “root”, “password”) or die(mysql_error());
$db_list = mysql_list_dbs($conn);
$db_count = mysql_num_rows($db_list);
for($i=0;$i<$db_count;$i++){
echo mysql_db_name($db_list, $i) . “<br />”;
}
?>
It moves the record pointer
MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | JS |
| 3 | HTML |
| 4 | AS |
+—-+——+
Example
<?php
$conn = mysql_connect(“localhost”, “root”, “password”) or die(mysql_error());
mysql_select_db(“database_name”,$conn);
$userInfo = mysql_query(“SELECT * from users”);
echo “<pre>”;
print_r(mysql_fetch_row($userInfo));
mysql_data_seek($userInfo,3);
print_r(mysql_fetch_row($userInfo));
mysql_close($conn);
?>
Output
Array
(
[0] => 1
[1] => PHP
)
Array
(
[0] => 4
[1] => AS
)
It creates a MySQL database
Example
<?php
$conn = mysql_connect(‘localhost’, ‘root’, ‘passowrd’);
mysql_query(“CREATE DATABASE database_name”, $conn) or die(“Failed”);
?>
It open a connection to a MySQL Server
Example
<?php
$conn = mysql_connect(‘localhost’, ‘root’, ‘password’);
echo mysql_client_encoding($conn);
mysql_close($conn);
?>
It closes MySQL connection
Example
<?php
$conn = mysql_connect(‘localhost’, ‘root’, ‘password’);
echo mysql_client_encoding($conn);
mysql_close($conn);
?>
It returns the name of the character set for the current connection
Example
<?php
$conn = mysql_connect(‘localhost’, ‘root’, ‘password’);
echo mysql_client_encoding($conn);
?>