我不知道我做错了什么,但我已经尝试了一切。这是我的代码,它说
mysqli_real_escape_string():无法在第207行获取mysqli
是
$message = mysqli_real_escape_string($con, strip_tags($_REQUEST['message']));
这是我表单的代码
<form method="POST">
<input type="text" name="message" placeholder="Message" autocomplete="off"/>
<input type="submit" name="submit"/>
</form>
<?php
if (isset($_POST['submit']))
{
$message = mysqli_real_escape_string($con, strip_tags($_REQUEST['message']));
if($message == null){
$warning = "<div class='alert alert-danger'><strong>Error!</strong> You can't leave the message field blank! Fill something in.</div>";
}else{
$sql = "INSERT INTO messages(Message, Username, User_Rank)VALUES('$message', '$my_username', '$my_rank')";
mysqli_query($con, $sql);
//UPDATE products SET product_name='52 inch TV', product_code=
$sql2 = "UPDATE users SET Total_Messages=Total_Messages + 1 WHERE UID=$my_uid";
mysqli_query($con, $sql2);
unset($_POST);
//header('Location: index.php');
}
}
?>