php连接mysql

来源:互联网 发布:银杉软件 编辑:程序博客网 时间:2024/06/05 12:04
<?php      header("Content-type: text/html; charset=utf-8");      //连库      $conn = mysql_connect('localhost', 'root', '');      if($conn){          echo "连接成功"."<br>";      }else{          echo mysql_error();      }      //选库      if(mysql_select_db('wtu')){          echo "数据库选择成功";      }else{          echo mysql_error();      }      //设置字符      mysql_query('set names utf8');?>
0 0