MYSQL
$conn = @mysql_connect('localhost','root','root');//括号的里的分别代表主机、用户名、密码
mysql_select_db('test',$conn);//选择库
mysql_query('set names gbk',$conn);//设置字符集
$sql ="select * from news ";
$result = mysql_query($sql,$conn);
============================================================================================================================
PDO
$dsn = "mysql:host=127.0.0.1;dbname=test";
$db = new PDO($dsn, 'root', 'root');
$rs = $db->query("SELECT * FROM save");
$result_arr = $rs->fetchAll();
==============================================================================================================================
mysqli
$mysql = new mysqli('127.0.0.1','root','root','dd');
//dump($mysql);die;
$mysql->set_charset('utf8');
$sql="insert into suoyin values('','然','10000','sdsdasdasfsdfd')"
$mysql->query($sql);