【发布时间】:2013-04-06 23:23:00
【问题描述】:
请耐心等待,我知道有很多关于此错误的帖子。但我浏览了它们,似乎无法找到解决我特定问题的方法。
我试过“isi”、“sss”,但“sii”不起作用。不知道该怎么做任何帮助都会很棒。
不太确定在哪里使用 var_dump();了解有关我的问题的更多信息。我对 PHP 还很陌生,知道这也会有很大帮助。
感谢您对我的包容!抱歉有重复的话题。
代码:
<tr>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random; ?>" name="name"/>
</td>
</form>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random3; ?>" name="name"/>
</td>
</form>
</tr>
<tr>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random6; ?>" name="name"/>
</td>
</form>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random4; ?>" name="name"/>
</td>
</form>
</tr>
<tr>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random5; ?>" name="name"/>
</td>
</form>
<form action="Voting_action.php" method="post">
<td><br />
<input type="submit" class="buttontable1" value="<?php echo $random2; ?>" name="name"/>
</td>
</tr>
<?php
include ('login-home.php');
$mysqli = new mysqli("", "", "", "");
if ($mysqli->connect_error) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_error . ") " . $mysqli->connect_error;
}
if (!($stmt = $mysqli->prepare("INSERT INTO table(id, name, votes) VALUES (id, '".$_POST['name']."', '".$votes."')"))) {
echo "Prepare failed: (" . $mysqli->error . ") " . $mysqli->error;
}
$id = 1;
这一行:
if (!$stmt->bind_param("isi",$id, $_POST['name'], $votes)) {
echo "Binding parameters failed: (" . $stmt->error . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->error . ") " . $stmt->error;
}
$stmt->close();
?>
【问题讨论】:
标签: php phpmyadmin