Set Date() in a variable

Hi all,

I am having a slight issue on what should be a simple (most likely) operation. I need to set a variable to the current date so that it can be stored in a MySQL DB. The SQl column is called date_job_rec with data type ‘date’.

the following is the code which sets the variable sgathered from a form and inputs them into the SQL argument, this works fine. But $date_job_rec isnt passing the data across (or somethign).

	$date_job_rec = date('Y - m - d');
	$job_status = '-';
	
	
	$sql = 'Insert into property set house_name="' .$house_name_text. '" , 
	house_number="' .$house_number_text. '" , 
	addline1="' .$addline1_text. '",
	addline2="' .$addline2_text. '",
	town = "' .$town_text. '",
	county = "' .$county_text. '",
	postcode = "' .$postcode_text. '",
	job_status = "' .$job_status. '",
	contact = "' .$contact_text. '",
	access = "' .$access_text. '",
	msg = "' .$msg_text. '",
	date_job_rec = "' .$date_job_rec. '", 
	client = "'.$client.'" ';

Many thanks in advance

I can not belive it was spaces!!! ty it now works.

Also thanks for the info on the use echo and phpadmin, i’m still so very very new to this and debuggin is an art i havent looked at yet! (well not properly)

still so much to learn, and loving it!

$date_job_rec = date('Y-m-d');

rm the spaces…

In any case you can always

echo $sql onto the page and take a good look at it

or paste it into PhpMyAdmin or whatever you use to manage your db.

That way you separate PHP problems from pure SQL errors