Php automatically converts strings consisting of numerical values to a number for magnitude comparisons, i.e. numbers take precedence. If what you are doing isn’t working, its due to something else, such as the logic you have that’s not actually testing if a row of data was fetched before using the data.
This also indicates that you probably don’t have php’s error_reporting set to E_ALL and display_errors set to ON, so that php will help you by reporting and displaying all the errors that it detects.
Here’s a version of your code listing a bunch of programming practices, that in most cases simplifies the code -
<?php
// build the sql query statement in a php variable. this makes debugging easier and separates the sql syntax as much as possible from the php syntax.
// don't use SELECT *. list the columns you want in the SELECT term
// for what you are showing you are doing, there's no point in a LIMIT term in this query
// if you use ? place-holders, it will cut down on the amount of typing, simplifying the code
$sql = "SELECT no_of_baths, no_of_showers FROM qutSurvey WHERE quote_id = ?";
// your database connection variable should be named as to what it is, i.e. $pdo
$stmt = $pdo->prepare($sql);
// the default fetch mode should be set to assoc when you make the connection, so that you don't need to keep setting or specifying it throughout your code
// $sql->setFetchMode(PDO::FETCH_ASSOC);
// variables should be named as to the meaning of the data in the variable. don't use variables with names like $a
$stmt->execute([ $a ]);
// you should fetch the data into an appropriately named variable in the php 'business' logic, that knows how to query for and fetch the data
// then test/use that variable at the correct point in the html document
$quote_data = $stmt->fetch();
// inside the html document...
// test/use the data, displaying a message if there is no matching data
if(!$quote_data)
{
// because the failure code is usually much shorter than the success code, complement the condition being tested and put the failure code first. this will result in easier to read code
echo 'No result found.';
}
else
{
// don't copy variables to other variables for no reason. this is just a waste of time typing. just use the original variables
// $no_of_baths = $row['no_of_baths'];
// $no_of_showers = $row['no_of_showers'];
//$qty_bathrooms = intval($no_of_baths);
if($quote_data['no_of_baths'] > 1)
{
echo '<p>more than one bathroom</p>';
}
}