Hi All, I need help in below coding as it is not working. What I'm trying to do here, if $type contains "today" value then bring all record which has today's date, If $type contains "tomorrow" bring all tomorrow's record. Do you think below coding is correct? becuase when I run this query I get exception but if I place only one $query and outside of if.. else the same query runs without errors. Thank you for your help Regards $query; $date = date("d/m/y"); if($type=="today") { $query = "SELECT * FROM gig where gig_Date= $date"; } else if($type=="tomorrow") { $tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); $query = "SELECT * FROM gig where gig_Date= $tomorrow"; } else if($type=="week") { $week = mktime(0, 0, 0, date("m") , date("d")+6, date("Y")); $query = "SELECT * FROM gig WHERE g.gig_Date <= ".$date." OR g.gig_Date >=".$week."; } $result = mysql_query($query)or die(mysql_error()); return $result; } ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ