1) return null; else return mysqli_fetch_assoc($results); } function query_one_or_more_results($query_stmt) { $conn = get_connection(); $results = mysqli_query($conn, $query_stmt); mysqli_close($conn); if (mysqli_num_rows($results) == 0) return null; else return $results; } /* * Executes a statement. Type is typically either 0 or 1, where 0 is an INSERT or UPDATE, * and 1 is DELETE. This is to determine whether a boolean value should be returned or * the ID of the row(s). */ function exec_statement($stmt, $type) { $conn = get_connection(); $results = mysqli_query($conn, $stmt); if ($type == 0) $results = mysqli_insert_id($conn); mysqli_close($conn); return $results; } function get_connection() { // Connect to the DB $conn = mysqli_connect(HOST, USER, PASS, DB); return $conn; }