Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 多列货币兑换_Php_Mysql_Sql - Fatal编程技术网

Php 多列货币兑换

Php 多列货币兑换,php,mysql,sql,Php,Mysql,Sql,我的MySQL表中有两列total和dollars。我需要将美元兑换成卢比,并将其存储在我的total字段中。我可以将实时美元汇率相乘并存储结果吗 我需要一个数学函数的SQL查询,如下所示: total = dollars * current_dollar_rate_in_rupees 我可以使这个转换动态吗?如果是这样的话,我的SQL查询将是怎样的? 因此,只需将此查询提供的值作为“total”存储在数据库中 SELECT dollars * current_dollar_rate_in_r

我的MySQL表中有两列
total
dollars
。我需要将美元兑换成卢比,并将其存储在我的
total
字段中。我可以将实时美元汇率相乘并存储结果吗

我需要一个数学函数的SQL查询,如下所示:

total = dollars * current_dollar_rate_in_rupees
我可以使这个转换动态吗?如果是这样的话,我的SQL查询将是怎样的?

因此,只需将此查询提供的值作为“total”存储在数据库中

SELECT dollars * current_dollar_rate_in_rupees from tablename

通过此查询,您可以将转换结果存储到
总计
字段中:

UPDATE `tablename` SET `total` = `dollars` * <current_dollar_rate_in_rupees>;
UPDATE`tablename`SET`total`=`dollars`*;

到目前为止,您尝试了什么<代码>更新表格集合总计=美元*当前美元汇率(单位:卢比)?或者,您甚至可以
从表中选择美元*以卢比表示的当前美元汇率作为总计
,以便在每次运行SELECT查询时进行转换…如何获取以卢比表示的实时美元汇率?它一直在变化,所以我如何才能将实时值分配给可变的当前美元汇率(单位:卢比)?MySQL不知道当前美元汇率(单位:卢比)。您需要找到一些web服务,以便在定时(每天/每小时/等)的基础上将更新的信息输入数据库。然后利用这些信息计算价格