I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase
Perhaps you can do this with something like
selectSELECT count(*)
from tbl_blacklist,FROM tbl_cmdatabase(
where '$number' in (selectSELECT number fromFROM tbl_blacklist
UNION
SELECT number FROM tbl_cmdatabase ) unionAS selectQ
where Q.number from= tbl_cmdatabase)'$number'
When the count returned is 0, it means that $number
is not in the tables. It's possible this is not the best query for this job, but it's the first thing I could think ofit will work OK.
You can play around with it here:
http://sqlfiddle.com/#!2/7d697/16/0http://sqlfiddle.com/#!2/7d697/23