Question
PHP, SQL : Apache (ports 80 & 443) and MySQL (port 3306) Need to add functionality to edit and delete review Example: $query=DELETE FROM entries
PHP, SQL : Apache (ports 80 & 443) and MySQL (port 3306)
Need to add functionality to edit and delete review
Example:
$query="DELETE FROM entries WHERE id={$_POST['id']} LIMIT 1";
$r=mysqli_query($conn,$query);
if (mysqli_affected_rows($conn)==1) {
//it worked!
}
$query="UPDATE entries SET name='$name', review='$review' WHERE id={$_POST['id']}";
$r=mysqli_query($conn,$query);
if (mysqli_affected_rows($conn)==1) {
//it worked!
}
Settings for creating MySQL Account:
creds.php
$username = "reviews_system";
$password = "foobar";
$host = "localhost";
$database = "reviews";
$conn = @mysqli_connect($host, $username, $password, $database);
?>
read_reviews.php
Reviews
require("creds.php");
$query = 'SELECT * FROM entries ORDER BY date_entered DESC';
if($r = mysqli_query($conn, $query)) {
while($row = mysqli_fetch_array($r)) {
print "
{$row['name']}
{$row['review']}
";
}
}
mysqli_close($conn);
?>
Create a user with the following information: Username: reviews_system Hostname: localhost Password: foobar Add user account Login Information User name: Host name: Password: Re-type: Authentication Plugin Generate password: Use text field: Local Use text field: Generate reviews_system localhost Strength: Native MySQL authentication Extremely weak
Step by Step Solution
3.41 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
Question General Guidance The answer provided below has been developed in a clear step by step mann...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started