$query = "SELECT * FROM users WHERE id = 1"; $result = $db->doQuery($query); $data = $result->fetch_assoc();
$query = "UPDATE sales SET quantity=10 WHERE id = 1"; $result = $db->doQuery($query);
$query = "INSERT INTO products (name, price) VALUES ('Product A', '10')"; $result = $db->doQuery($query);In this example, the doQuery method is used to execute a SQL query that inserts data into a 'products' table. The query inserts the name and price values into the table. The query does not return any data so there is no need to use the fetch_assoc method.