I have the following code with an if statement and the value is negative one is some rows of data. Yet when I use this statement it reads the -1 value as 1.
if ($row ['bedrooms'] == '-1')
{
echo "<td class='propdescres'>Studio</td></tr>";
}
else
{
echo "<td class='propdescres'>" . $row['bedrooms'] . "</td></tr>";
}
I tried adding
$studio = $row ['bedrooms']*'-99';
And changing my statement to:
if ($studio == '99')
{
echo "<td class='propdescres'>Studio</td></tr>";
}
else
{
echo "<td class='propdescres'>" . $row['bedrooms'] . "</td></tr>";
The following is the query I am using to get the data:
$result = mysqli_query($con, "SELECT realty.id, realty.unit_num, realty.address, realty.price, realty.bedrooms, realty.bathrooms, realty.metadesc FROM realty
The field type is tinyint(3) and when I query the database for bedrooms = -1 it returns vales but in my echo results in php all the -1 values are 1.
Can somebody please give me a little insight as to what I am doing wrong or how I can retrieve negative values?
Thank you.