I'm not really an expert on mod rewrites, and I don't know exactly what you are trying to do.
It looks like you are trying to take any url that ends with ?mainID= and then a number. Then if that url has two parts and a slash you redirect it to the showdr.php page passing the variables as firstName and lastName.
I'd try removing the RewriteCond line and see if it works. Get the RewriteRule working properly and then add back the Condition so you can at least isolate which line is failing.