I have a function that goes through the product
database table and if there is a row with supplierid
and name
that matches the parameters, then it returns true.
But it always returns true even if it shouldn't.
function checkifhoused($productname, $supplier)
{
$db = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
$sql = "SELECT * FROM " . TBL_PRODUCTS;
$result = mysqli_query($db, $sql);
while ($row = $result->fetch_assoc()) {
if ($row['supplierid'] == $supplier and $row['name'] == $productname) {
return true;
}
}
return false;
}