Question: Write a prepared statement for the below code $name = mysql_real_escape_string(htmlentities($_POST['name'])); $content = mysql_real_escape_string(htmlentities($_POST['content'])); $submit = mysql_real_escape_string(htmlentities($_POST['submit'])); echo $username; if(isset($submit)) { if($name && $content){ $sql
Write a prepared statement for the below code![Write a prepared statement for the below code $name = mysql_real_escape_string(htmlentities($_POST['name'])); $content](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3ca2b88095_03466f3ca2adeb2f.jpg)
$name = mysql_real_escape_string(htmlentities($_POST['name'])); $content = mysql_real_escape_string(htmlentities($_POST['content'])); $submit = mysql_real_escape_string(htmlentities($_POST['submit'])); echo "$username"; if(isset($submit)) { if($name && $content){ $sql = "INSERT INTO posts (title, content, time, owner) VALUES ('$name', '$content', now(), '$username')"; $result = $mysqli->query($sql); if($result){ echo "Your reply has been saved"; header ('Location: index.php'); } else{ echo $result; echo "problem with query"; } } else{ echo "one or more fields are empty"; } } else { echo "Your reply has been saved, ";
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
