这篇文章介绍的内容是关于php操作mysql ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
header("Content-type: text/html; charset=utf-8");$db_config = array( "host"=>"localhost", "db_user"=>"root", "db_password"=>"<i style="color:transparent">本文来源gaodai$ma#com搞$$代**码)网8</i><strong>搞代gaodaima码</strong>hxsbhxsb", "db_name"=>"chenchen" );$link = @mysql_connect($db_config["host"],$db_config["db_user"],$db_config["db_password"]);if($link){ // echo "数据库连接成功!";}else{ die("数据库连接失败,请与管理员联系!");}mysql_select_db($db_config["db_name"]);mysql_query("set names utf8");$res = mysql_query("select * from tab3");if($res){ $row = mysql_fetch_row($res); var_dump($row); $row = mysql_fetch_row($res); var_dump($row);}else{ echo "错误信息".mysql_error();}
mysql_num_rows(result) //返回结果集的行数
mysql_num_fields(result) //返回结果集的列数
mysql_field_name(result, $i) //返回结果集第i个字段的名字
相关推荐:
php操作字符串转换成php数组的几种方法
php操作redis的命令分享
以上就是关于php操作mysql的详细内容,更多请关注搞代码gaodaima其它相关文章!