我最近一直致力于我自己的PHP项目,当我将文件传输到WAMP时,我一直遇到这个错误。
这是我得到的错误:
(!)警告:mysqli_select_db()要求参数1为mysqli,第4行的C:\ wamp64 \ www \ link.php中给出的字符串
这是我的代码:
<?php
@include_once 'settings.php';
//session_start
$link = mysqli_connect($servername, $username, $password); //MySQL Host, Username, password
$db_selected = mysqli_select_db('database', $link); //MySql database
mysqli_query("SET NAMES utf8");
function fetchinfo($rowname, $tablename, $finder, $findervalue)
{
if ($finder == "1")
$result = mysqli_query("SELECT $rowname FROM $tablename");
else
$result = mysqli_query("SELECT $rowname FROM $tablename WHERE `$finder` =`$findervalue`");
$row = mysqli_fetch_assoc($result);
return $row[$rowname];
}
function secureoutput($string)
{
$string = mysqli_real_escape_string($string);
$string = htmlentities(strip_tags($string));
$string = str_replace('>', '', $string);
$string = str_replace('<', '', $string);
$string = htmlspecialchars($string);
return $string;
}
?>