Syntax assistance please

Hopefully a nice easy one (well not so easy for me!)

	$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.'", 
	fee = client.fee ';

As you can see it is an INSERT command query. The problem part i have is the very last element. I want this last field ‘fee’ to be given the value of the field ‘fee’ held in a different table ‘client’.

(I dont want to join the value as if the client fee should change in future i do not want the historic instructions altered to represent the new fee)

fee is INT in both cases.

I know this is a simple one, but we all have to start somewhere :wink:

Many thanks in advance

Dibley

Instead of INSERT… SET… use the INSERT … SELECT… construction:

$sql = "
  INSERT INTO property 
  SELECT 
      '$house_name_text'
    , '$house_number_text', 
    , ....
    , '$client'
    , client.fee
  FROM client
  WHERE [B][I][COLOR="Red"]add the conditions to get the right fee value from the client table[/COLOR][/I][/B]
";

Make sure you get only one fee value from the client table, because a row will be inserted for each fee value returned.