Check whether a field value exists in a custom table when a webform is submitted
Just replace 

$result=db_query("SELECT * FROM {test_customerid} WHERE naid = :naid",array(':naid'=&gt;$dataSub));


with 

$result=db_query("SELECT * FROM {test_customerid} WHERE naid = :naid",array(':naid'=&gt;$dataSub))-&gt;fetchAll(); 


and try, hope it will work