Hi, I have some confusion with Variables scope. I searched but couldn't figure it out :( The question is: one variable which changes according to if... else statment, how do you change the value of that variable? Actually $query is changing on $type variable so I tried doing using if.. else statment. Please clarify me. function select_entries_quick ($offset=0,$location,$type) { global $limit; $query; $date = date("d/m/y");
if (empty($offset)) { $offset = 0; } 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 = safe_query($query); return $result; } --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.