如何在没有ID的情况下显示项目的描述

发布于 2025-01-16 18:36:14 字数 1684 浏览 0 评论 0原文

我的代码是这样的:

$conn = new mysqli($dbhost,$dbuser,$dbpass,$db) or die("Connect Failed: %s\\n". $conn-\>error);

    $category=$_POST['category'];
    
    if($category==1)
    {
        $RetStockPHP="SELECT id, CONCAT(imei,', ',brand,', ',model) AS Eqname FROM tbl_equipment";
        if($res1=mysqli_query($conn,$RetStockPHP))
        {
            if(mysqli_num_rows($res1)>0)
            {
                while($row1=$res1->fetch_assoc())
                {
                                
                    $idPHP1=$row1['id'];
                    $EqnamePHP1=$row1['Eqname'];
                    echo "<option value='$idPHP1'>$EqnamePHP1</option>";
                    
                }
            }
        }
    }
    else
    {
        $RetStockPHP="select it.id as itemcode, concat(art.description,', ',it.description,', ',ut.description) as fitem , category from ref_item as it left join ref_article as art on it.article_id = art.id left join ref_unit as ut on it.unit = ut.id order by it.id;";
        if($res1=mysqli_query($conn,$RetStockPHP))
        {
            if(mysqli_num_rows($res1)>0)
            {
                while($row1=$res1->fetch_assoc())
                {
                    $ItemcodePHP1=$row1['itemcode'];
                    $fitemPHP1=$row1['fitem'];
                    echo "<option value='$ItemcodePHP1'>$fitemPHP1</option>";
            
                }
            }
        }
    }

耗材的结果如下:

2|圆珠笔,蓝色,2mm 笔尖,盒子

和设备的结果如下:

20220010201|IMEI-12345、ASUS、VIVOBOOK 14。 code>

如何不显示ID?

抱歉这里是新手。任何帮助将不胜感激!

My code is this:

$conn = new mysqli($dbhost,$dbuser,$dbpass,$db) or die("Connect Failed: %s\\n". $conn-\>error);

    $category=$_POST['category'];
    
    if($category==1)
    {
        $RetStockPHP="SELECT id, CONCAT(imei,', ',brand,', ',model) AS Eqname FROM tbl_equipment";
        if($res1=mysqli_query($conn,$RetStockPHP))
        {
            if(mysqli_num_rows($res1)>0)
            {
                while($row1=$res1->fetch_assoc())
                {
                                
                    $idPHP1=$row1['id'];
                    $EqnamePHP1=$row1['Eqname'];
                    echo "<option value='$idPHP1'>$EqnamePHP1</option>";
                    
                }
            }
        }
    }
    else
    {
        $RetStockPHP="select it.id as itemcode, concat(art.description,', ',it.description,', ',ut.description) as fitem , category from ref_item as it left join ref_article as art on it.article_id = art.id left join ref_unit as ut on it.unit = ut.id order by it.id;";
        if($res1=mysqli_query($conn,$RetStockPHP))
        {
            if(mysqli_num_rows($res1)>0)
            {
                while($row1=$res1->fetch_assoc())
                {
                    $ItemcodePHP1=$row1['itemcode'];
                    $fitemPHP1=$row1['fitem'];
                    echo "<option value='$ItemcodePHP1'>$fitemPHP1</option>";
            
                }
            }
        }
    }

The result is like this for Supplies:

2|Ballpen, blue, 2mm tip, box

and for equipment:

20220010201|IMEI-12345, ASUS, VIVOBOOK 14.

How do I not display the ID?

Sorry Newbie here. Any help would be much appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文