mySQL groupconcat returning BLOB xxxB / Kib

匿名 (未验证) 提交于 2019-12-03 02:41:02

问题:

On advice from a member and a previous post I'm running a query against multiple tables on an interspire shopping cart database that looks like this:

SELECT c.customerid, c.custconfirstname, c.custconemail, o.ordstatus, o.orddate, GROUP_CONCAT(  'Order Id: ', orderid,  ' | Product name: ', ordprodname,  ' | Quantity: ', ordprodqty,  '<br>' ) AS ordered_items FROM isc_customers c LEFT OUTER JOIN isc_orders o ON o.ordcustid = c.customerid LEFT OUTER JOIN isc_order_products op ON op.orderorderid = o.orderid LEFT OUTER JOIN isc_product_images pi ON pi.imageprodid = op.orderprodid GROUP BY c.customerid HAVING COUNT( DISTINCT o.ordcustid ) >0 AND o.ordstatus = 0 AND o.orddate < UNIX_TIMESTAMP( ) -  '18000' AND o.orddate > UNIX_TIMESTAMP( ) -  '259200' 

The result I'm getting in phpmyadmin looks like this:

customerid  custconfirstname    custconemail        ordstatus   orddate     ordered_items 6532        Cust1               CUST1@EXAMPLE.COM   0           1337502962  [BLOB - 498B] 5522        Cust2               CUST2@EXAMPLE.COM   0           1337670453  [BLOB - 284B] 4321        Cust3               CUST3@EXAMPLE.COM   0           1337507476  [BLOB - 521B] 1235        Cust4               CUST4@EXAMPLE.COM   0           1337577095  [BLOB - 1.0  KiB] 9560        Cust5               CUST5@EXAMPLE.COM   0           1337518452  [BLOB - 1.0  KiB] 

When I try to echo the result in a php page to test it, nothing is returning. I'm just wondering what the Blob means and how to use it. It's obvious it's got some data in it, I just don't know how to access it or use it.

回答1:

In phpmyadmin above the values displaying you can see the +Options button Click on that then check the Show BLOB contents and click Go button.it will display the values.

You can use the ordered_items in the similar way how you are accessing the customerid.

in php

foreach($resultSet as $row) {    $customerid = $row['customerid'];    $ordered_items = $row['ordered_items']; } 

The variable $ordered_items contains the values as it is displayed in phpmyadmin.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!