Complete the code to get all rows from a custom table using $wpdb.
$results = $wpdb->[1]("SELECT * FROM wp_custom_table");
The get_results method fetches multiple rows from the database as an array of objects.
Complete the code to safely prepare a query with a variable using $wpdb->prepare.
$sql = $wpdb->prepare("SELECT * FROM wp_users WHERE ID = [1]", $user_id);
The %d placeholder is used for integers in $wpdb->prepare.
Fix the error in the code to insert a new row safely using $wpdb.
$wpdb->[1]('wp_custom_table', array('name' => $name, 'age' => $age), array([2], [3]));
Use insert to add a row. The format array needs %s for string and %d for integer.
Fill both blanks to update a user's email safely using $wpdb.
$wpdb->[1]('wp_users', array('user_email' => $email), array('ID' => $user_id), array([2]), array([3]));
Use update to change data. The format array matches the data types: string for email, integer for ID.
Fill all three blanks to delete a user by ID safely using $wpdb.
$wpdb->[1]('wp_users', array('ID' => [2]), array([3]));
Use delete to remove rows. The where clause uses the user ID variable, and the format is integer %d.