Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Application Development » SUM(price) (how to include SUM in sql_select (if possible...))
SUM(price) [message #2677] Fri, 18 February 2011 08:32 Go to next message
dsstanescu is currently offline  dsstanescu
Messages: 12
Registered: August 2010
Junior Member
Hi,

If I include a SUM operator in one of my php files (want to group by code and the get the total price per code), I will get an error:

...
// customise the SQL SELECT statement
$sql_select = 'code, SUM(price)';
$sql_from = null;
$sql_where = null;
$sql_groupby = 'code';
$sql_having = null;
$sql_orderby = null;
$sql_search_table = null;
...

here is the error:

Fatal Error: Uncaught exception fron DOMException, message = Invalid Character Error (# 256).

Error in line 385 of file 'C:\xampp\htdocs\radicore\includes\error.inc'.

Thanks.
Dan
Re: SUM(price) [message #2678 is a reply to message #2677] Sat, 19 February 2011 05:10 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
You must provide an alias name using 'SUM(price) AS alias' otherwise when it comes to write that column name into the XML document it will barf as 'SUM(price)' contains '(' and ')' which are invalid as element names in XML.

Re: SUM(price) [message #2679 is a reply to message #2678] Sat, 19 February 2011 06:07 Go to previous message
dsstanescu is currently offline  dsstanescu
Messages: 12
Registered: August 2010
Junior Member
Thanks, is working fine!
Previous Topic: USER Management
Next Topic: Adding SUM() data to screen and report
Goto Forum:
  


Current Time: Tue Dec 03 14:24:37 EST 2024

Total time taken to generate the page: 0.01071 seconds