php连接mysql

<?php
$con = mysql_connect("localhost","root","inash");
echo "默认网站";
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("mysql", $con);
$result = mysql_query("SELECT * FROM user");
while($row = mysql_fetch_array($result))
{
echo $row["Host"] . " " . $row["User"];
echo "<br />";
}

mysql_close($con);
?>
Tagged with: ,

发表评论

邮箱地址不会被公开。 必填项已用*标注

*