Database not updating, is there an error log somewhere, I can check

Hi I am trying to update a table in a MySQL db with this code. Before this runs I connect to the db and correctly assign values to the $variables from a form.

//update db
	$sql = mysql_query("UPDATE landlordsincome SET
	furn_accom ='$furn_accom',
	unfurn_accom ='$unfurn_accom',
	rents_rates ='$rents_rates',
	prop_repairs ='$prop_repairs',
	fin_costs ='$fin_costs',
	prof_fees ='$prof_fees',
	services ='$services',
	repair_desc ='$repair_desc',
	cost_repair ='$cost_repair',
	exp_desc ='$exp_desc',
	tot_exp ='$tot_exp',
	WHERE username='$id'")

if (mysql_query($sql)) {
	echo'<p> Details Updated</p>';
	} else {
	echo'<p>Error Updating Details</p>';
;

I am new at PHP and My Sql, so it could be my code, what a surprise that would not be. But I have checked it over from several resources, but it could still be wrong But if not where can I look for errors as at the moment I am just getting the error message echoed from the script above.

Thanks in advance

Sam

www.php.net/mysql_error might help you out.

Thanks furicane well I added this code

if (!$sql) {
    	$message  = 'Invalid query: ' . mysql_error() . "\
";
    	$message .= 'Whole query: ' . $sql;
    	die($message);
	}

And this tells me that there is an error in the syntax
Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE username =‘admin’’ at line 13

and then using mysql_errno() it said the error 1064, which I then looked up on php sites and it did not help me.

Anyone any ideas what the syntax error is?

Here is the code again

//update db
	$sql = mysql_query("UPDATE landlordsincome SET
	furn_accom ='$furn_accom',
	unfurn_accom ='$unfurn_accom',
	rents_rates ='$rents_rates',
	prop_repairs ='$prop_repairs',
	fin_costs ='$fin_costs',
	prof_fees ='$prof_fees',
	services ='$services',
	repair_desc ='$repair_desc',
	cost_repair ='$cost_repair',
	exp_desc ='$exp_desc',
	tot_exp ='$tot_exp',
	WHERE username ='$id'");
	

Thanks

Sam

you have a dangling comma, exactly where the error message says to look

colporter, can I suggest that you switch to using “Leading Commas”. See the “Leading Commas” section of page 3 of this SitePoint Article which explains the benefits of Leading Commas.

Thanks r937, yes I found that last night eventually, the dangling comma, could not be seen for looking but hey now thanks to everyone that replied I have learnt several lessons so thanks

and thanks also Space Phoenix I have read the article and will adopt leading commas looks like a good idea another thing learnt.

Cheers onward and upward.