Unit 5
Unit 5
11. Write an SQL query to insert data into a users table with columns id, name, and email.
12. How do you execute an SQL INSERT statement in PHP? Provide an example.
13. What is the difference between mysqli_query() and mysqli_prepare() for inserting
data?
14. Write a PHP script to fetch all records from a MySQL table and display them in an
HTML table.
15. Explain the difference between fetch_assoc() and fetch_array() methods in PHP.
16. How do you update a record in a MySQL table? Provide an SQL query example.
17. Write a PHP script to update a user's email based on their id.
18. What is the importance of using the WHERE clause in UPDATE and DELETE queries?
19. Write a SQL query to delete a record from the students table where id=5.
20. How do you handle SQL injection when updating or deleting data in PHP?
Additional Conceptual Questions