It sends a raw HTTP header to a client.
Example
<?php
header(‘Location: http://www.phpcodez.com/’);
?>
It sends a raw HTTP header to a client.
Example
<?php
header(‘Location: http://www.phpcodez.com/’);
?>
It executes a query on a MySQL database and buffering the result
Example
<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_result(mysql_unbuffered_query( “SELECT * FROM users”),1);
mysql_close();
?>
It returns the current thread ID
Example
<?php
mysql_connect(“localhost”, “root”, “phpcode”);
$tables = mysql_list_tables(“database_name”);
echo mysql_thread_id();
?>
Output
1097
Its deprecated . It returns the table name of field
Example
<?php
mysql_connect(“localhost”, “root”, “phpcode”);
$tables = mysql_list_tables(“database_name”);
for ($i = 0; $i < mysql_num_rows($tables); $i++)
echo mysql_tablename($tables, $i), “<br />”;
?>
Output
Uusers
It the current system status of the MySQL server
Example
<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_stat();
mysql_close();
?>
Output
Uptime: 18520 Threads: 7 Questions: 3591 Slow queries: 2 Opens: 21411 Flush tables: 1 Open tables: 63 Queries per second avg: 0.193
It sets the client character set
Example
<?php
mysql_set_charset(charset,resource)
?>
It select a MySQL database
MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | ASP |
| 3 | JSP |
| 4 | JS |
| 5 | AS |
+—-+——+
Example
<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
mysql_select_db(“database_name”);
echo mysql_result(mysql_query( “SELECT * FROM users”),1);
mysql_close();
?>
Output
2
It returns the value of a field in a recordset
MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | ASP |
| 3 | JSP |
| 4 | JS |
| 5 | AS |
+—-+——+
Example
<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_result(mysql_query( “SELECT * FROM users”),1);
mysql_close();
?>
Output
2
Escapes a string for use in SQL statements
MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | ASP |
| 3 | JSP |
| 4 | JS |
| 5 | AS |
+—-+——+
Example
<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_num_rows(mysql_query( “SELECT * FROM users WHERE name='”.mysql_real_escape_string(“PHP”).”‘”));
mysql_close();
?>
Output
1
It executes a query on a MySQL database
MySQL Table – Users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | ASP |
| 3 | JSP |
| 4 | JS |
| 5 | AS |
+—-+——+
Example
<?php
mysql_pconnect(“localhost”, “root”, “phpcode”) or die(mysql_error());
$db_selected = mysql_select_db(“database_name”);
echo mysql_num_rows(mysql_query( “SELECT * FROM users”));
mysql_close();
?>
Output
5