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

Write a PHP code that read the data from the \"tblActor\" table, and generate a

ID: 3852169 • Letter: W

Question

Write a PHP code that read the data from the "tblActor" table, and generate a JSON response similar to the following format. Name the PHP file "ViewAllActors.php". {"actors": [{"name": "Brad Pitt", "description": "Brad Pitt is an American actor and film producer. He has received a Golden Globe Award, a Screen Actors Guild Award, and three Academy Award nominations in acting categories", "dob": "December 18, 1963", "country". "United States", "image": "http: \ ors.com\brad.jpg"}, {"name": "Tom Cruise", "description": "Tom Cruise, is an American film actor and producer. He has been nominated for three Academy Awards and has won three Golden Globe Awards.", "dob": "July 3, 1962", "country": "United States", "image": "http: \Actors.com\tom.jpg"}', {"name": "Angelina Jolie", "description": "Angelina Jolie is an American actress, author. She has received an Academy Award, two Screen Actors Guild Awards, and three Golden Globe Awards.", "dob": "December 18, 1963", "country": "United States", "image": " http: \lActors.com\angelina.jpg"}]}

Explanation / Answer

1) Open MySQL Database Connection in PHP:

**************************************************

Shown for the tbl_employee table.

2) Fetch Data from MySQL Database:

************************************************

3) Convert MySQL Result Set to PHP Array:

********************************************************

4) Convert PHP Array to JSON String:

*********************************************

Over all code for the above is:

************************************

Convert MySQL to JSON File in PHP:

********************************************

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