This is sort of complicated to me for some reason, I used to be able to solve these things quick but I'm rusty with PHP right now.
I am basically doing this, a variable named $varA has a value of any integer between 1-10 being generated randomly. This works.
Here is the code:
$varA = 5; //lets use 5 for example
//pull integers from the db
$sql = "SELECT number FROM mytable ORDER BY number ASC";
$query = mysql_query($sql);
//in the database, only 1,2,3,4,6 exist, we create a loop to list all the numbers
while($result = mysql_fetch_array($query))
{
//if the number in the database is the same as $varA, bold it
if($varA == $result['number'])
{
echo '<strong>' . $result['number'] . '</strong><br />';
}
else
{
echo $result['number'] . '<br />';
}
}
Now if $varA had a value of 2, it would look like this
1
2
3
4
6
But $varA equals to 5 in this case, and 5 doesn't exist in the database. How can I make it so that if it does not exist, something like this can be shown:
Unknown Number
1
2
3
4
6