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 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. ''; }   

In fact I want to divide the user in the purchase column with all the comma, then get the result, Separate the comma, then compare each number in PHP.

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 explosion () :

  $ purchase = explosion (',', $ row ['purchase']) Do; Forex currency ($ $ purchase as purchase) {echo 'you bought' Buy $ '& lt; Br> & # 39; & # 39; }    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -