@peacemaker, here's an SQL trick that should simplify your life:
Let's assume you have a table called Cards. When you query it you get, for example, this:
Select *
From Cards;
id ndo value suit
AH 1 Ace Hearts
2H 2 2 Hearts
3H 3 3 Hearts
4H 4 4 Hearts
5H 5 5 Hearts
6H 6 6 Hearts
7H 7 7 Hearts
8H 8 8 Hearts
Now if you were to query this table with this Sql statement:
Select *
From Cards
Where id = 'N/A';
No rows would be returned and an exception raised.
Here's a work around which is easy to implement and costs hardly anything, time wise that is:
select COUNT(*) AS RowNo, *
From cards
Where ID = 'N/A';
RowNo id ndo value suit
0 NULL NULL NULL NULL
In essence, you're guaranteed to have a row returned and you can check with (pseudo) column RowNo (or whatever name you want) how many rows (0 or 1) were returned. You combine two queries in one.