美好的一天,我有一个大问题,我知道 PHP 使用 mysql 数据库而 javascript 不使用。但我想要完成的事情是使用数据库数值“如 9000”并从通过单击“如 3000”的产品生成的 javascript 数值中减去它,然后它必须给出 6000 的最终答案。
这就是我所拥有的
<table><tbody>
<tr>
<td class='odd'><?php echo htmlentities($_SESSION['usr']['usr'], ENT_QUOTES, 'UTF-8');
?></td>
<td class='even'> </td>
</tr>
<tr>
<td class='odd'>Your Value Points: </td>
<td class='even'><span id="valuep" class="valuep"><?php echo
htmlentities($_SESSION['usr']['points'], ENT_QUOTES, 'UTF-8'); ?></span></td>
</tr>
<tr>
<td class='odd'> </td>
<td class='even'> </td>
</tr>
<tr><td class='odd'>Total Items: </td><td class='even'><span id='simpleCart_quantity'
class='simpleCart_quantity'></span></td></tr>
<tr><td class='odd'>SubTotal: </td><td class='even'><span id='simpleCart_total'
class='simpleCart_total'></span></td></tr>
<tr><td class='odd'> </td><td class='even'> </td></tr>
<tr><td class='odd'>Total</td><td class='even'>
<?php
$first_number = htmlentities($_SESSION['usr']['points'], ENT_QUOTES, 'UTF-8');
$second_number = "This must be the simpleCart_total";
$sum_total = $first_number - $second_number;
print ($sum_total);
?>
</td>
</tr>
</tbody>
</table>