SELECT * FROM `gallery` WHERE 1=1 AND g_publish='Y'