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 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器