Jump to content

Recommended Posts

Hi

 

While I am not a fan of completely splitting the processing and the display of data (they are too related to do it totally), it does appear that you want just use a table field in much the same way you would use a flat file.

 

If you have a table containing rows which you want to display on screen as a list then you could use GROUP_CONCAT in your SQL. However most of the time it would probably be more flexible and maintainable to do the formatting within php.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/187482-in-a-database/#findComment-990217
Share on other sites

I think i've not explained myself. I dont want to put any 'code' within the database itself. Ideally I'd wanted to put something like this in a field:

 

List Item 1, List Item 2, List Item 3

 

And then I can format it in the PHP to read as a list

 

  • List Item 1
  • List Item 2
  • List Item 3

 

There must be a way of doing this, or something similar to this? Or do I have to create hundreds of fields in the table for each List Item?

Link to comment
https://forums.phpfreaks.com/topic/187482-in-a-database/#findComment-990315
Share on other sites

Hi

 

Normally depending on the data I would expect the table to contain one row for each of those items. ie, it the list items were children for a parent then there would be one row per child.

 

If you did this then you could either bring back the rows in MySQL and use php to output the <li></li> tags, or you you use GROUP_CONCAT in MySQL to bring them back from the database with most of the tags in place.

 

Having a comma seperated field within a table makes it very difficult to do joins on the data to other tables.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/187482-in-a-database/#findComment-990427
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.