Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6. Suppose your MySQL database contains a table named clients, and suppose among

ID: 3715559 • Letter: 6

Question

6. Suppose your MySQL database contains a table named clients, and suppose among its columns is and one named last_name . Can you quickly perform each of the following tasks, at the MySQL command line as well as from a PHP script? one named first name First, compose a query that would retrieve the first and last names (last names first) of all clients whose last name is either Jones or Green, and then assign the query to a variable named squery Second, send the query to MySQL from a PHP script, assuming the connection has already been made and the database chosen.

Explanation / Answer

$query = "SELECT firstname, lastname FROM Clients WHERE lastname='Jones' OR lastname='Green' ";

$result = $conn->query($query); //MYSQLi Object-Oriented

$result = mysqli_query($conn, $query);  //MYSQLi Procedural

//assumed that $conn is the connection made to the database.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote