我在日志中不断收到此错误,似乎没有做任何事情/停止工作,但我想知道它是什么。
任何人都可以告诉我我的bind_param
声明在哪里出错吗?我尝试添加s
(删除s
)删除变量,它只是不断弹出。
[Mon Jun 19 20:37:53.363632 2017] [fcgid:warn] [pid 41665] [client 5.69.190.95:57872] mod_fcgid:stderr:PHP警告:mysqli_stmt :: bind_param():变量数量没有' t匹配第79行/home/tools/public_html/test/phpfiles/databaseclass.php中准备好的语句中的参数数量,引用者:http://tools.cidetech.co.uk/test/domaindiagnostics.php?userInput=mmorpg.com
[Mon Jun 19 20:37:53.363724 2017] [fcgid:warn] [pid 41665] [client 5.69.190.95:57872] mod_fcgid:stderr:PHP警告:mysqli_stmt :: bind_param():变量数量与数字不匹配第117行/home/tools/public_html/test/phpfiles/databaseclass.php中准备好的声明中的参数,引用者:http://tools.cidetech.co.uk/test/domaindiagnostics.php?userInput=mmorpg.com
[Mon Jun 19 20:40:45.864311 2017] [fcgid:warn] [pid 42276] [client 5.69.190.95:57885] mod_fcgid:stderr:PHP警告:mysqli_stmt :: bind_param():变量数量与数字不匹配准备好的参数中的参数
这是它引用的代码 -
第79行 -
function searchData()
{
$servername = $this->servername;
$username = $this->username;
$password = $this->password;
$dbname = $this->dbname;
#Opens the MYSQL Connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
##Prepares the statement
$stmt = $conn->prepare("SELECT * FROM dns WHERE domain LIKE '$this->domainname' ");
$stmt->bind_param('s',$this->domainname);
$stmt->execute();
$result = $stmt->get_result();
117
## Function display search results
function displaySearchResults($idArray)
{
$servername = $this->servername;
$username = $this->username;
$password = $this->password;
$dbname = $this->dbname;
#Opens the MYSQL Connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
## Begining of formatting of drop down table
echo "<table class='table table-condensed'>";
echo "<tr>";
echo "<th>Date</th>";
echo "<th>Time</th>";
echo "</tr>";
##Loops through all the matching ID's
for ($i = 0; $i < count($idArray); $i++)
{
$id = $idArray[$i];
$stmt = $conn->prepare("SELECT * FROM dns WHERE id LIKE '$id' ");
$stmt->bind_param('s',$id);
$stmt->execute();
$result = $stmt->get_result();
## For ever matching ID it prints out the date/time into the drop do
答案 0 :(得分:4)
$stmt = $conn->prepare("SELECT * FROM dns WHERE domain LIKE ? ");
$stmt->bind_param('s',$this->domainname);
您在字符串中输入问号并将其插入。这就是它的工作原理。尝试在第79行而不是你所放的