php - Get Mysql data and split be delimiter -
I am creating a store when users purchase an item in a MySQL database, it will be added that they are Product ID 1 or 2 bought or both. Let's say if a user buys both (ID1 and 2), then show mesql column In fact I want to divide the PS Noob here! This is a poor database design, you should purchase a table with a separate line for each Dressing But if you are stuck with it, then use purchase table
user to show
1,2 Should he do it. But the main part is that how can I get results in PHP and I can separate from the loop in the delimiter
, , then get all the numbers separately and do this: No more delimiter is found till the time of expansion within the loop with
// $ I. If ($ buy [$ i] == 1) {'you bought' echo $ I. ''; }
user in the
purchase column with all the comma, then get the result, Separate the comma, then compare each number in PHP.
explosion () :
$ purchase = explosion (',', $ row ['purchase']) Do; Forex currency ($ $ purchase as purchase) {echo 'you bought' Buy $ '& lt; Br> & # 39; & # 39; }
Comments
Post a Comment