connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT * FROM links WHERE code='$str'"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { //this is if the record was found echo "