I'm trying to get strings from a my_sqli query that only start with a certain letter, however it always outputs the whole array. Here's my code, I'm trying to get the first value, see if it starts with the correct letter, then echo it if it does, then go on to the next.
$strSQL = "SELECT title FROM blogtable ORDER BY title ASC";
$titleResult = mysqli_query($con, $strSQL);
while($rowTitle = mysqli_fetch_array($titleResult))
{
$strTitle = $rowTitle['title'];
$subTitle = substr($strTitle,0,2);
$subNum = ord($subTitle);//This gets me the value of the first letter
if($subNum = $topLetter)//$topLetter = 65, which is capital A
{
echo $strTitle;
echo "<br>";
}
}
So the problem here is that, say if I have 3 things, and only 2 start with A, it will output all 3, but I just want the 2 that start with A.