根据成员的建议和以前的帖子,我正在对Interspire购物车数据库中的多个表进行查询,如下所示:
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'
我在phpmyadmin中得到的结果如下所示:
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]
当我尝试在php页面中回显结果以对其进行测试时,什么也没有返回。我只是想知道Blob的含义以及如何使用它。显然其中有一些数据,我只是不知道如何访问或使用它。
在phpmyadmin上方显示的值中,您可以看到+ Options按钮单击,然后检查Show BLOB内容并单击Go按钮。它将显示这些值。
您可以按照与访问customerid相似的方式来使用ordered_items。
在PHP中
foreach($resultSet as $row) { $customerid = $row['customerid']; $ordered_items = $row['ordered_items']; }
变量$ ordered_items包含phpmyadmin中显示的值。