php文件链接数据库基本代码
<?php
$conn=@mysql_connect("localhost","root","");
if($conn==null)
die("数据库连接失败1,因为你的账户密码错误");
mysql_query("set names 'gb2312'");
if(!mysql_select_db("root"))
{
die("数据库连接失败2,因为你的数据库名不对");
}
?>
$conn=@mysql_connect("localhost","root","");括弧里分别填写 数据库路径 数据库用户名 数据库密码
if(!mysql_select_db("root")) root的意思是数据库名
浙公网安备 33010602011771号