PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE products ( product_sku INT, product_type VARCHAR(100), contact_name VARCHAR(100), phone VARCHAR(100), full_price VARCHAR(100), product_name VARCHAR(100), product_id INT, rating INT, PRIMARY KEY (product_sku) ); INSERT INTO products ( product_sku, product_type, contact_name, phone, full_price, product_name, product_id, rating ) VALUES (1, 'Type', 'Contact Name', '0000 000 000', '0.00', 'Product Name', 1, 0), (3, 'Type', 'Contact Name', '0000 000 000', '80.00', 'Product Name', 3, 0);
Copy Clear
Copy Format Clear
<?php // $mysqli is already declared as a working database connection by this sandbox $price = '80.00'; $id = 3; $sql = <<<SQL SELECT * FROM products WHERE full_price = ? AND product_id = ? SQL; $stmt = mysqli_prepare($mysqli, $sql); mysqli_stmt_bind_param($stmt, "si", $price, $id); mysqli_stmt_execute($stmt); foreach (mysqli_stmt_get_result($stmt) as $row) { var_dump($row); }
Show:  
Copy Clear