douxing5199 2017-07-31 18:00
浏览 208
已采纳

如何在MySQL表单结果之前添加货币符号

Hopefully I can better explain here than my title :(

Basically I've got the working mysql bootstrap table from the below site https://sourcecodesite.com/use-bootstrap-tables-display-data-mysql.html

I've set it up to display and fetch the results I require from my database, however I am trying to put a pound sign "£" before the sales table shows its result (as highlighted below)

enter image description here

I have tried to edit the code like below but haven't been successful, hoping someone here can help me :)

{
    field: 'sales',
    title: £'Job Price',
    sortable: true,
}

The generation code is as followed

<?php 
    require 'db.php';
        
        $sqltran = mysqli_query($con, "SELECT * FROM results_tbl_1 WHERE ENG_ID='".$_SESSION['username']."'ORDER BY RECORD_ID DESC") or die(mysqli_error($con));
        $arrVal = array();
        
        $i=1;
        while ($rowList = mysqli_fetch_array($sqltran)) {
                                 
                        $name = array(
                                'num' => $i,
                                'rec'=> $rowList['RECORD_ID'],
                                'call'=> $rowList['CALL_ID'],
                                'eng'=> $rowList['ENG_ID'],
                                'workcode'=> $rowList['Work_Code'],
                                'sales'=> $rowList['Sales'],
                                'paid'=> $rowList['How_Paid'],
                                'invoice'=> $rowList['Invoice Number'],
                                'date'=> $rowList['Date Completed']
                                
             
                                
                            );      


                            array_push($arrVal, $name); 
            $i++;           
        }
             echo  json_encode($arrVal);        
 

        mysqli_close($con);
?> 

</div>
  • 写回答

1条回答 默认 最新

  • dongxin5429 2017-07-31 18:59
    关注

    See if this makes sense. We put the pounds symbol into a (hypothetical) field named "price."

    $name = array(
        'num' => $i,
        'rec'=> $rowList['RECORD_ID'],
        'call'=> $rowList['CALL_ID'],
        'eng'=> $rowList['ENG_ID'],
        'workcode'=> $rowList['Work_Code'],
        
        'price' => '£' . $rowList['Price'], // MAYBE SOMETHING LIKE THIS
        
        'sales'=> $rowList['Sales'],
        'paid'=> $rowList['How_Paid'],
        'invoice'=> $rowList['Invoice Number'],
        'date'=> $rowList['Date Completed']
    );
    
    array_push($arrVal, $name); 

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog