开发者

mySQL PHP separate terms in mysql table

开发者 https://www.devze.com 2023-02-22 04:17 出处:网络
I have multiple entries in a mysql table field, these are separated with commas; data1, data2开发者_运维问答, data3 etc. How do I using PHP separate out these terms and display them separately in a ta

I have multiple entries in a mysql table field, these are separated with commas; data1, data2开发者_运维问答, data3 etc. How do I using PHP separate out these terms and display them separately in a table like so;

Data
------------
Data 1
------------
Data 2
------------
Data 3
------------
etc


First of all, you shouldn't have multiple values in a single column. However, regardless of why you have it, there is a function in php called explode which allows you to explode a string at a specific delimiter. You can have something like this: $myArray = explode(',', $mydata_coming_from_database);


After retrieval of data from database,You can use explode() function to create an array and loop that array.I think It will help you.


explode() is you one and only option

0

精彩评论

暂无评论...
验证码 换一张
取 消