Scriptcase POS DEMO

Hello
has anyone tried this code
$total =’[total]’;
$sql = “INSERT INTO sales
(total,date,stateid)
VALUES
(’[$total]’,NOW(),1);”;

sc_exec_sql ($sql);

sc_redir(dashboard);
can anyone correct me this code please ?when i am outputting the total value i always get 0 value in the database!
i tried with scriptcase support they didnt help much.

thanks for your help
aras saeed

Try this:
$now = date(‘Y-m-d’);//or whatever
$total =[total];
$sql = “INSERT INTO sales
(total,date,stateid)
VALUES
(’$total’,’$now’,1)”;

thank you so much for your reply
now instead of 0 value i am getting value of 150 for every sale i dont know from where it comes the number 150

It’s coming from [total]

Still i am not getting the right total value for the sale total amount if i try from dashboard pos always getting zero value, as i followed the pos demo videos i dont know where else i can check there might be a mistakes

Try changing the name of variable to $total1 or [total2] do not use the same name.

$total1 =’[total]’;
$sql = “INSERT INTO sales
(total,date,stateid)
VALUES
(’$total1’,NOW(),1);”;