mysql_select_db('code1');
mysql_query("set names'utf8'");
$result = mysql_query('select*from user limit1');
$row = mysql_fetch_assoc($result);
print_r($row);
//接上面的代码
mysql_query("set names'utf8'");
$result = mysql_query('select*from user limit1');
$row = mysql_fetch_assoc($result);
print_r($row);
//接上面的代码
2017-03-19
<?php
//多个连接数据库
$link1 = mysql_connect('127.0.0.1','code1','');
$link2 = mysql_connect('127.0.0.1','code1','',true);
//开启一个新的连接
$res = mysql_query('select * from user limit 1', $link1); //从第一个连接中查询数据
mysql_connect('127.0.0.1', 'code1', '');
mysql_select_db('code1');
mysql_query("set names 'utf8'");
//多个连接数据库
$link1 = mysql_connect('127.0.0.1','code1','');
$link2 = mysql_connect('127.0.0.1','code1','',true);
//开启一个新的连接
$res = mysql_query('select * from user limit 1', $link1); //从第一个连接中查询数据
mysql_connect('127.0.0.1', 'code1', '');
mysql_select_db('code1');
mysql_query("set names 'utf8'");
2017-03-19