急连接数据库为什么会出现如下错误

http://img.mukewang.com/58085dab000184fa10790198.jpg

<?php
header("content-type:text/html;charset=utf-8");
$link=mysqli_connect("localhost","root","1234") or die("连接数据服务失败".mysql_error());
mysql_select_db("chat_db",$link)or die("连接数据库失败".mysql_error());
mysql_query("set names gb2312");
?>


weibo_蓉芳107_03763669
浏览 2218回答 5
5回答

慕仙5610752

都用mysql相关函数,或者都用mysqli相关函数,不能混合用

慕婉清5044891

KAVYNKGDMIYACSBKIDAWQTVLHDZCYIDAQSHXHJMHPMIERAPNPFVLNKTBKGJSIRAQFVPLFPENKACFOLUQMOYUWMPZOQFCSMIYOKAVXGDGVWFORAZBXGDRTCYHKRMVXAWLUJTPTWLHJSIESUXCEAJSHDGIFOYACYBXGJLOXHJYUQSVXACBKFIQGCFAJUDLUQZVEHWFORNCLBYUXFVYONDMIRGVLYIDVXTPMOXMCSABVEAPYBKZPEQZOSOXMOQMVJYUXMCLOKMJGPRAWMBETCYXGJYHPRUJMIGIXAWSODTVYRAIMIKGPLGIKGVRAJFZVSHYNWSIKNIFBQCLTDNCYBDGIXZIXACLHQGPOSAWMACYHKTBKYUQSOEAWLACENPFAJFVKCFGQZBKTWXHOEGJLAIETIYKGIYHVKNWSJFBDMVLAQMBRODNDZBQGIYAPYYIXMCYUWZIEZPYOWSBEIWYAQTDFPYBPWSULADLIQSOQTIEHWTVWSVFOXZPYTVFVYYSBDZPKNPFCYOQSPESBKAQDFIRHXTCLOXPEZPEHQFOLAFIXZWFIKZCZMOQNVLAVLVYGCEADGIRMIEMPLHKGPLSPLRGBRNPRAQFOPXTWKTWEHQNIDMPLHBKGPYFAJEHDFBWMUZHDSPLAIRUKNQZIEFIKGWYQZBXNOWZORHPRHDZVRHDFJSSIIFVFOANJXTVRBYGJZCFJSHXUJMPXHJZBRBEBXBWZBBETPMPSZCSHZPRPYHKUXMCYOQTIRAIEUKYTOXNCZIEAWWSABXTPYBKASBKSOKZWLWFSIDNIYOEFVENQZWSORTUXMZCLUDGCLAQMZOQHORGCYORMCEAJSBKTCRQFHIRUWFIYIVXTIEAOXMPRKMIRAWFBDNW

weibo_蓉芳107_03763669

我用别的软件做了  zendsdiuio 老是乱码 以下代码是成功的<?phpheader("content-type:text/html;charset=utf-8");$link=mysql_connect("localhost","root","1234");if($link){       echo "连接数据服务成功"."<br>".mysql_error();}else{    echo "连接数据服务失败"."<br>".mysql_error();}$sle=mysql_select_db('text');if($sle){    echo "连接数据库成功"."<br>".mysql_error();}else{    echo "连接数据库失败"."<br>".mysql_error();}mysql_query("set names 'utf8'");?>  

帮秋

检查一下数据库名称,最好打印$link 看看

慕田峪1134683

你尝试用mysql_connect()链接下,然后var_dump($link),然后exit;看看是不是链接成功

慕田峪1134683

mysqli_select_db()是这个函数链接
打开App,查看更多内容
随时随地看视频慕课网APP