Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

Create a user with the following information: Username: reviews_system Hostname: Iocalhost Password: foobar Add user accountCreate database with same name and grant all privileges. Grant all privileges on wildcard name (usernamel_\%). Grant all priv

There are no favorite tables. New information_schema mysql performance_schema phpmyadmin reviews New

creds.php

$username = "reviews_system";

$password = "foobar";

$host = "localhost";

$database = "reviews";

$conn = @mysqli_connect($host, $username, $password, $database);

?>

read_reviews.php

Read Reviws

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']}

Edit

Delete


";

}

}

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Management Leadership questions

Question

When should a percent sign (%) be used with the LIKE operator?

Answered: 1 week ago