EDIT: When posting PHP code, please use the board's [noparse]
..
[/noparse] bbcode tags as they make your code much easier to read and analyze.
One problem I see is here:
if(!$result)
{
echo "There was a problem getting the data";
}
else if(!$result)
{
echo "There were no results";
}
Note that the two if() conditions are exactly the same. Moreover, the echo in the second if() statement suggests that you should be using something like [man]mysql_num_rows/man in the if() condition.
Fix that, and see if you get the 'no results' message instead, as it sounds like your SELECT query didn't match any rows.