php计算数量的方式

假设表名称为“mytable”,

统计不同日期的总人数:

selectday,sum(people);


统计不同日期的出现行数:

selectday,count(people);

㈡ php计算器怎么做

<html>
<head>
<title>运算</title>
</head>
<body>
运算步骤:
<?php
$content=$_POST["content"];
if($content!=""){
run($content);
}
//去括号
function run($content){
$j=0;
for($i=0;$i<strlen($content);$i++){
if($content{$i}=="("){
$j=$i;
}
else if($content{$i}==")"){
$left=substr($content,0,$j);
$right=substr($content,$i+1,strlen($content)-$i);
$indexvalue=substr($content,$j+1,$i-$j-1);
getResult($indexvalue);
run($left.getValue().$right);
break;
}
if($i==strlen($content)-1){
getResult($content);
echo "<br>运算结果:".getValue();
break;
}
}
}
//运算
function getOne($one,$two,$char){
$result;
switch ($char) {
case "+":
$result=$one+$two;
break;
case "-":
$result=$one-$two;
break;
case "*":
$result=$one*$two;
break;
case "/":
$result=$one/$two;
break;
}print($one.$char.$two."=".$result." ");
return $result;
}
//递归运算
function getResult($content){
$j=0;//存储加减号位置
$array;//存储加减号
$char;//存储加减号位置
for($i=0;$i<strlen($content);$i++){
if($content{$i}=="+" || $content{$i}=="-" || $content{$i}=="*" || $content{$i}=="/" ){
if($i!=0){
$array[$j]=$i;
$char[$j]=$content{$i};
$j++;
}
}
}
if(count($char)==1){
$one=substr($content,0,$array[0]);
$two=substr($content,$array[0]+1,strlen($content)-$array[0]);
$result=getOne($one,$two,$char[0]);
setValue($result);
}else{
for($i=0;$i< count($char);$i++){
if($char[0]=="+" || $char[0]=="-"){
if($char[1]=="+" || $char[1]=="-"){
$one=substr($content,0,$array[0]);
$two=substr($content,$array[0]+1,$array[1]-$array[0]-1);
$result=getOne($one,$two,$char[0]);
$right=substr($content,$array[1],strlen($content)-$array[1]);
getResult($result.$right);
break;
}else if($char[1]=="*" || $char[1]=="/"){
$one=substr($content,$array[0]+1,$array[1]-$array[0]-1);
$left=substr($content,0,$array[0]+1);
if($char[2]==""){
$two=substr($content,$array[1]+1,strlen($content)-$array[1]);
$result=getOne($one,$two,$char[1]);
getResult($left.$result);
break;
}else{
$two=substr($content,$array[1]+1,$array[2]-$array[1]-1);
$result=getOne($one,$two,$char[1]);
$right=substr($content,$array[2],strlen($content)-$array[2]);
getResult($left.$result.$right);
break;
}
}
}else if($char[0]=="*" || $char[0]=="/"){
$one=substr($content,0,$array[0]);
$two=substr($content,$array[0]+1,$array[1]-$array[0]-1);
$result=getOne($one,$two,$char[0]);
$right=substr($content,$array[1],strlen($content)-$array[1]);
getResult($result.$right);
break;
}
}
}
}
$value;
//得到结果
function getValue(){
global $value;
return $value;
}
//存储结果
function setValue($value1){
global $value;
$value=$value1;
}
?>
<form action="999999999.php" method="post">
<?php
echo "<input type=text name=content value=".$content.">";
?>
<input type="submit" value=" 计 算 " >
</form>
</body>
</html>

㈢ PHP查询MYSQL多个表并进行汇总计算

你先将支付表和其它消费表根据时间段查出结果如下:
(select ss as cbss,sch,yxf,ls from cb where ss between '2014-04-01' and '2014-04-30') a
其它消费也内同上 起名b,收容入也是这样
然后通过
select 。。。(这里是你想要显示的字段) from () a,() b,() c where a.sch = b.sch and b.sch = c.sch

㈣ PHP 关于数据表计算问题的逻辑

1,检索所有m_price 为空抄的数据,计算price的和。袭
2,检索所有m_price不为空的数据,计算m_price的和。
3,把他们两个相加。
计算和可以用sum
select sum(price) from xx_table where m_price = '';//注意''是两个单引号。
具体你自己研究吧。

㈤ php计算俩表的内容

selectk.num*j.priceassum,k.kid,j..jid=j.id;


应该可来以


如果price是会自经常变化的,而kede要以当时为准的话,

尽量在kede表生成记录时就写出结果。

㈥ php 怎么统计数据表某一个表的大小,不是记录数!!!

这个需要查询 information_schema.TABLES. 其中的 data_length 就是你要的...
给你个查询数据库大小的语句.

select concat(round(sum(DATA_LENGTH/1024/1024),2), ' M') as dbsize from information_schema.TABLES where table_schema= 'mysql';

价格版 where 条件就可以指定单个表权了.
select concat(round(sum(DATA_LENGTH/1024/1024),2), ' M') as dbsize from information_schema.TABLES where table_schema= 'mysql' and table_name='user';

㈦ php如何查询某个表一共多少条记录

需要准备的材料分别是:电脑、php编辑器、浏览器

1、首先,打开php编辑器,新建php文件,例如:index.php。

㈧ 简单的php计算器

你那个位置条件有问题。 我简单处理了专下属
if( isset($_POST['submit']) ){

$number3=$_POST['number1']+$_POST['number2'];

}else{
$number3='';
}

㈨ Php计算公式代码

你好,25000块填满的话,也许会有好多种商品的组合 你们是需要一种、还是多种,对于组合有什么要求,比如想取得包含商品数最少的那个组合?另外还有一种可能性就是无论填充什么组合产品都无法正好用完25000,会有余额,这个问题你们需要怎么处理?

㈩ php计算数值

这个用PHP做不了 因为你那个不需要通过服务器二十在客户端完成的,需要使用JavaScript

在版
<form>标签中添加权id="myfo"
text1中添加 id="te1"
text2中添加id="te2"
text3中添加id="te3" onclick="result();"

在html区域键入下面代码:
<script>
function result()
{
var new_result=(myfo.te1.value*myfo.te2.value).toFixed( 2 );
myfo.te3.value=new_result;;
}
</script>

以上代码已修改