I have a very modest database on my server and I use php to allow people to query it. Its very simple, they enter a value that should be in column 1 (account_num) and I return the value for column 2 (balance) (same row). Here is the question: What if the value they enter doesn't match any values in column 1? Right now, I get this ugly error message:
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 2 in test.php.....on line 231
I would prefer to NOT show that and to instead show some custom text like that entry isn't in the database please try again.
Here is the relevant php code I am using. If you can tell me what code I need to insert and where I would GREATLY appreciate it.
This code is initiated when the user types in their account number and hits submit on another page.
$sql = $_POST['account_num'];
$query= "SELECT balance FROM Test WHERE account_num='$sql'";
$result=mysql_query($query);
$BAL=mysql_result($result,"balance");
echo "<p>",$sql," has a balance of: $", $BAL, ".";
Thanks in advance!!