mySQL groupconcat returning BLOB xxxB / Kib

2020-05-08 12:37发布

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.

标签: php mysql sql blob
1条回答
兄弟一词,经得起流年.
2楼-- · 2020-05-08 13:03

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.

查看更多
登录 后发表回答