我收到mysqli错误,它预计有2个参数,只有1个参数,但我看不出我错过了什么。
// Create connection
$con=mysqli_connect("connection stuff");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
<?php
if(isset($_POST['submit1011']))
{
$query1 =mysqli_query ($con, "UPDATE blog_semicategory SET english_navn_godkend=".$_POST['godkend_english101']." WHERE semikatagori_id=" . $id) or die(mysqli_error());
mysqli_query($query1);
echo('<META HTTP-EQUIV="refresh" CONTENT="1">');
echo "<h3>Oprettes...</h3>";
}
?>
<center><img src="../include/images/<?php echo $r1011->english_navn_godkend ?>.png"></center><br />
<center>
<form action="" method="post">
<input type="hidden" name="godkend_english101" value="2">
<input type="submit" name="submit1011" value="Godkend Navn" />
</form>
</center>
答案 0 :(得分:3)
$query1 =mysqli_query ($con, "UPDATE blog_semicategory SET english_navn_godkend=".$_POST['godkend_english101']." WHERE semikatagori_id=" . $id) or die(mysqli_error());
mysqli_query($query1);
$query1
不是查询。请参阅mysqli_query
的手册。该函数返回mysqli_result
。实际上,您尝试执行两次相同的查询,第二次尝试不指定第一个链接参数。