$host ='localhost';
$root = 'root'; $dbpass = ''; $db = 'zhuce'; $f = mysql_connect($host,$root,$dbpass); if(!$f){ echo '数据库连接失败'; die; } $f=mysql_query("use $db"); if(!$f){ echo '数据库选择失败'; } mysql_query("set names utf8"); function my_select($sel){ //查询数据 $res = mysql_query($sel); $result = array(); while($se=mysql_fetch_assoc($res)){ $result=$se; } return $result; } function my_insert($sql){ //插入数据 $insert=mysql_query($sql); }