I am having trouble getting an sql query to go through to the database. I am checking this with an if ($sql) {echo "success";} else {echo "error";}
and I keep getting "error". The code preceding my query all seems to work. If the query syntax is correct, what could be potential trip-ups that I have overlooked? Here is the code in question:
$sql = mysql_query(
"INSERT INTO monthly_balances (
bal_id,
account_id,
bal_date,
bal_month_sales,
bal_month_returns,
bal_month_net,
bal_month_coop,
bal_YTD_sales,
bal_YTD_returns,
bal_YTD_net,
bal_lastYTD_sales,
bal_lastYTD_returns,
bal_lastYTD_net
)
VALUES (
DEFAULT,
'$account_id',
'$bal_date',
'$bal_month_sales',
'$bal_month_returns',
'$bal_month_net',
'$bal_month_coop',
'$bal_YTD_sales',
'$bal_YTD_returns',
'$bal_YTD_net',
'$bal_lastYTD_sales',
'$bal_lastYTD_returns',
'$bal_lastYTD_net'
)
");
if($sql) {
echo 'success';
}
else {
echo 'error';
}
Thank you