Hi,

I have a "discount" table that carries percentage discounts that should be looked up 
when the customer submits a discount code and taken into calculation of the total 
price. My table looks something like this:

field names:    |senior|student|...
values:            |0.20|0.50|...

Now, when the senior writes in the textfield "senior"(as a discount code), everything 
is fine since my SELECT query looks up $discount field (which in this case is 
"senior") and returns 0.20. However, if by mistake he misspells "senor" instead of 
"senior" (or tries to make up a discount code) he will get an error, because there is 
no such field in my MySQL table. How can I catch that error (such discount doesn't 
exist) and have perl do something?

thanks,
Mariusz  

ps. My Select query looks up bunch of other stuff at the same time, but I guess I 
could separate them into two and maybe react to the error caused during discount 
lookup and have perl continue... but how can I do that? How can I separate the error 
"such field doesn't exist" from any other error in MySQL? Would "prepare" stop the 
script the same way "selectrow_array" does?

Reply via email to