How to obtain the SUM () value of SQL? I am an emergency.

Source: Internet
Author: User
How to obtain the SUM () value of SQL? Urgent! Online, etc! I have a table named "test1". The field name "num" has three fields: 111222333 $ SQL = mysql_query (& quot; selectSUM (num) fromtest1 & quot ;); $ a = xxx ($ SQL); which function xxx should be used next? how can I obtain the SUM () value of SQL by setting the value of 666? Urgent! Online, etc! I am a Thai food
There is a table test1
Field name num
There are three fields 111 222 333

$ SQL = mysql_query ("select SUM (num) from test1 ");

$ A = xxx ($ SQL );


Which function xxx should be used to obtain the number 666 and assign it to the variable ???

Very grateful

------ Solution --------------------
SQL = mysql_query ("select SUM (num) as t_sum from test1 ");
$ Res = mysql_fetch_array ()
Echo $ res [t_sum]
------ Solution --------------------
$ A = mysql_fetch_array ($ SQL );
Echo"
";
Print_r ($ );
Echo"
";
------ Solution --------------------
SQL = mysql_query ("select SUM (num) as sum from test1 ");
$ Res = mysql_fetch_array ()
Echo $ res [sum]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.