我改變MySQL的代碼在項目中的mysqli,但現在我得到的消息,儘管所有數據庫的信息就在這裏「沒有選擇的數據庫」是代碼:沒有數據庫中選擇mysqli的消息
<?php
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root'); // Your database Username
define('DB_PASSWORD', 'root'); // Your database Password
define('DB_DATABASE', 'social'); // Your database Name
$connection = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD) or die(mysqli_error());
$database = mysqli_select_db($connection,DB_DATABASE) or die(mysqli_error());
mysqli_query($connection,$database);
mysqli_query($connection,"SET NAMES 'UTF8'");
mysqli_query($connection,"SET character_set_connection = 'UTF8'");
mysqli_query($connection,"SET character_set_client = 'UTF8'");
mysqli_query($connection,"SET character_set_results = 'UTF8'");
$path = "uploads/";
$LogoPaht="css/icons/";
$conversation_uploads = "conversation_images/";
$profile_image_path = "user_profile_uploads/";
$admin_path = "../".$LogoPaht;
$admin_profile_path='../'.$profile_image_path;
$admin_path_uploads='../'.$path;
$profile_cover_pic_path = "user_profile_cover_uploads/"; // User Profile Cover File
$perpage=10; // Updates perpage
$base_url='http://localhost/sociall/'; // base_url
$admin_base_url=$base_url.'smadmin/'; // Admin base_url
$gravatar=0; // 0 false 1 true gravatar image
$rowsPerPage=1000000; //friends list
$profilePerPage=3;
/*SMTP Details */
$smtpUsername='[email protected]'; //[email protected] or you can use your webmail like [email protected]
$smtpPassword='pass'; //gmail password or your webmail password
$smtpHost='ssl://mail.yourwebsitename.com'; //tls://smtp.gmail.com if yo
$smtpPort='465'; //465
$smtpFrom='[email protected]'; //[email protected]}
?>
'mysqli_query($ connection,$ database)'應該做什麼? '$ database'是一個布爾值,而不是SQL查詢字符串。 – Barmar
僅供參考,您可以將數據庫指定爲'mysqli_connect'的第四個參數,您不需要單獨調用'mysqli_select_db'。 – Barmar
mysqli_ *函數沒有與mysql_ *函數相同的API。請檢查手冊並更新功能 – codisfy