Source Code:
(back to article)
<?php // connect to database $mysqli = new mysqli("localhost","db_user","db_password","db_name"); $query = "SELECT * FROM products WHERE code = '$code'"; $result = $mysqli->query($query); if ($result) { if (mysqli_num_rows($result) > 0) { echo 'found!'; } else { echo 'not found'; } } else { echo 'Error: ' . mysqli_error(); } // close connection mysqli_close($mysqli); ?>
Result:
Report an issue