MySQL使用用户名和密码可以正常,但phpnow 的MySQL 测试结果显示数据库无法连接,代码有问题吗?
<?php$link=@mysqli_connect($_POST['mysqlHost'],$_POST['mysqlUser'],$_POST['mysqlPassw...
<?php
$link = @mysqli_connect($_POST['mysqlHost'], $_POST['mysqlUser'], $_POST['mysqlPassword']);
$errno = mysqli_connect_errno();
if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">OK</span> ('.mysqli_get_server_info($link).')';
else $str1 = '<span style="color: #ff0000; font-weight: bold;">Failed</span><br />'.mysqli_connect_errno();
?>
<tr>
<td colspan="2">服务器 <?=$_POST['mysqlHost']?></td>
<td colspan="2"><?=$str1?></td>
</tr>
<tr>
<td colspan="2">数据库 <?=$_POST['mysqlDb']?></td>
<td colspan="2"><?=(@mysqli_select_db($_POST['mysqlDb'],$link))?'<span style="color: #008000; font-weight: bold;">OK</span>':'<span style="color: #ff0000; font-weight: bold;">Failed</span>'?></td>
</tr>
</table>
<?}?>
MySQL使用用户名和密码可以正常登录 展开
$link = @mysqli_connect($_POST['mysqlHost'], $_POST['mysqlUser'], $_POST['mysqlPassword']);
$errno = mysqli_connect_errno();
if ($link) $str1 = '<span style="color: #008000; font-weight: bold;">OK</span> ('.mysqli_get_server_info($link).')';
else $str1 = '<span style="color: #ff0000; font-weight: bold;">Failed</span><br />'.mysqli_connect_errno();
?>
<tr>
<td colspan="2">服务器 <?=$_POST['mysqlHost']?></td>
<td colspan="2"><?=$str1?></td>
</tr>
<tr>
<td colspan="2">数据库 <?=$_POST['mysqlDb']?></td>
<td colspan="2"><?=(@mysqli_select_db($_POST['mysqlDb'],$link))?'<span style="color: #008000; font-weight: bold;">OK</span>':'<span style="color: #ff0000; font-weight: bold;">Failed</span>'?></td>
</tr>
</table>
<?}?>
MySQL使用用户名和密码可以正常登录 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询