php连接mysql数据库的代码

<?php
mysql_connect("localhost","root","123456") //填写mysql用户名和密码
   or die("Could not connect to MySQL server!");
mysql_select_db("database_name") //数据库名
   or die("Could not select database!");
mysql_query('set names "gbk"'); //数据库内数据的编码
?>

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>