Connecting data in PHP is accomplished by the mysql_connect() function or mysql_pconnect() function. Let me give you a brief introduction to PHP beginners.
Commonly used connection function mysql_connect()
mysql_connect(servername,username,password);
Long connection function mysql_pconnect()
mysql_pconnect(servername,username,password);
The code is as follows
代码如下 |
复制代码 |
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
|
|
Copy code
|
|
代码如下 |
复制代码 |
$conn = mysql_pconnect("localhost","root","123456") or die("Can not connect to MySQL");
echo "MySQL线程号:". MySQL_thread_id($conn). " ";
echo "Apache进程号". getmypid();
?>
|
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
I'm talking about mysql_pconnect, how can I bypass MySQL settings. The two most important parameters affecting mysql_pconnect are wait_timeout and interactive_timeout
The code is as follows
|
Copy code
|
$conn = mysql_pconnect("localhost","root","123456") or die("Can not connect to MySQL");
echo "MySQL thread number:". MySQL_thread_id($conn). " ";
echo "Apache process number".getmypid();
?>
http://www.bkjia.com/PHPjc/630705.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630705.htmlTechArticleConnecting data in php is done by the mysql_connect() function or mysql_pconnect() function. Now I will give you an introduction to php A brief introduction by the author. Commonly used connection functions mysql_connect() mysql_connec...
|