Getting records by date

I have the following code

if($property == 0) 
			{ 	
		$prop = "WHERE dfrom > ".date('Y-m-d')." ORDER BY dfrom DESC"; // Active only
			} 
		else 
			{ 
		$prop = "WHERE prop_id = ".$property." AND dfrom > ".date('Y-m-d')." ORDER BY dfrom DESC"; // All
			}
		$sql = mysql_query("SELECT * FROM bookings $prop", $db_con)  or die(mysql_error()); 
		$row = mysql_fetch_assoc($sql);// Get records where date from is greater than current date

I am trying to show record in a database which are after the current date. The above code is calling all records.

Does anyone have any suggestions

What’s the column type of ‘dfrom’? Try echoing the query to be executed, so you know it’s not something completely different from what you’re expecting. Use debugging tools like in the link in my signature.

I sorted it out about 5 seconds after posting the message, thanks for the reply anyway.

Sponsor our Newsletter | Privacy Policy | Terms of Service