Crude Operations in PHP Basics Quiz Quiz

Test your understanding of fundamental CRUD operations in PHP, including creating, reading, updating, and deleting data with simple examples.

  1. Identifying the Insert Operation

    Which function is used to add a new record into a MySQL database table using PHP and the mysqli extension?

    1. mysqli_create_table
    2. mysqli_read with ADD
    3. mysql_add with INSERT
    4. mysqli_store with ADD ROW
    5. mysqli_query with INSERT INTO
  2. Reading Data from Database

    What is the correct method to retrieve all records from a table named 'students' using PHP and mysqli?

    1. SELECT * FROM students
    2. GET * FROM students
    3. RETRIEVE ALL FROM students
    4. SHOW ALL FROM students
    5. EXPORT * FROM students
  3. Updating a Record

    Which SQL statement will correctly update the 'email' column for a user with id 10 in a PHP CRUD application?

    1. UPDATE users email TO 'new@example.com' WHERE id = 10
    2. SET email = 'new@example.com' IN users FOR id = 10
    3. UPDATE users SET email = 'new@example.com' WHERE id = 10
    4. CHANGE email IN users TO 'new@example.com' FOR id = 10
    5. MODIFY users SET email = 'new@example.com' AT id = 10
  4. Deleting a Row Safely

    What is the best practice to delete a row with a specific id from a 'products' table in PHP?

    1. ERASE FROM products WHEN id = 5
    2. DELETE * FROM products id = 5
    3. REMOVE FROM products SET id = 5
    4. DELETE products WHERE id = 5
    5. DELETE FROM products WHERE id = 5
  5. Escaping User Input

    Which PHP function should be used to safely escape user input when inserting data into a database to prevent SQL injection?

    1. escape_string_mysql
    2. mysqli_real_escape_string
    3. secure_input_filter
    4. htmlspecialchars
    5. mysql_input_escape