期望参数1在第8行是mysqli

期望参数1在第8行是mysqli

本文介绍了mysqli_select_db()期望参数1在第8行是mysqli的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我该怎么办如果有人出了什么问题,请更正并给予解决预先感谢

I Don't know what actually I should do and if there is something wrong somebody please correct it and give itthanks in advance

<?php
    $db_host = 'localhost';
    $db_user = 'root';
    $db_pass = '';
    $db_name = 'cms';

    $conn = mysqli_connect($db_host,$db_user,$db_pass) or die(mysql_error());
        mysqli_select_db($db_name,$conn);

?>

推荐答案

使用此:

$con = mysqli_connect($hostname,$user,$password,$database);

您不需要:

mysqli_select_db

您的代码将是:

$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_name = 'cms';

$con = mysqli_connect($db_host,$db_user,$db_pass,$db_name);

这篇关于mysqli_select_db()期望参数1在第8行是mysqli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 02:40