Hi, the last post was good but i don't think it answered everything. If you're looking that it not CONTAIN 2, then use like...
$query = mysql_query ("SELECT * from main,sections,topics WHERE mainsecid=secid AND maintopid=topid AND mainsecid not like '%2%' ORDER BY id DESC LIMIT 0,15") or die ("Yo, it's not working! - Code1A.");
if you want to exclude 2 in the first place use
not like '2%'
if in the middle use %2%, and if at the end use %2
for that matter you can use SUBSTRING() commands or REGEXP() commands. People underutilize mySQL commands, go see:
http://www.mysql.com/doc/en/Function_Index.html
Sam Fullman