简体   繁体   中英

mysql table data to multidimensional array

hi all i am new to PHP and multidimensional array are complicated for me .

i have a table

ordered_products(op_id int(), dp_name varchar(), product_id int(), product_quantity int()) and have data like

op_id   dp_name    product_id    product_quantity 

  1      smith        2              3
  2      smith        1              4
  3      adam         3              2
  4      adam         5              6
  5      smith        3              2

i need to display which customer purchased which item in how much quantity, i think i need multidimensional array to do this because simple select query is not working

please help

thanks!

It doesn't really matter whether you use a multidimensional array or just use the result set as-is. It depends on how you use the data after. You need to use the standard result set to create the multidimensional array anyway, so it's up to you if you wish to use the result set as-is to show the customer's history or first create the multidimensional array and then use that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM