Ok so basically I'm trying to create a simple web app
I want to check if one element is inside the table, and if inside I want to return a boolean value, like for example if "abc" is inside the table named "name" then return YES.
Here's my code, not working:
error_reporting(E_ALL);
$mysql = mysqli_connect(/* PRIVATE DATA */) or die ("ERROR CONNECTING TO THE DB");
if(isset($_POST['submit'])) {
$theAddress = $_POST['youtubeURL'];
$result = "SELECT * FROM data WHERE youtubeURL = '" . $theAddress . "'";
$query = mysqli_query($mysql, $result);
if (!$query) {
printf("Error");
} else {
printf("NO ERROR");
}
AND HERE'S THE NON-WORKING PART :
while($row = mysqli_fetch_array($query)) {
if ($row == 0) {
echo "NO RESULT LIKE THIS";
}else {
echo "AT LEAST ONE RESULT LIKE THIS";
}
}
}