close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

MySQL Data Formating For Product Catalogue

Thread began 7/17/2009 6:11 pm by Kevin373660 | Last modified 7/22/2009 7:00 pm by Justin Nemeth | 2704 views | 2 replies |

Kevin373660

MySQL Data Formating For Product Catalogue

I am using DataAssist to create a product catalogue with pages generated in PHP and the data stored in schema tables with MySQL. I have two basic formating questions:

1. When storing text in MySQL datatype LONGTEXT for the ProdLongDecs, what is the best way to formate on display page? Do I simply include the CSS tags in the text that is stored in the database table column and then create and apply CSS styles for those tags? For example, I would like to inlcude subheadings and a list of bulleted items included with product under the main long text discription.

2. WebAssist dynamic sample site BlueSkyMusic uses the DECIMAL(19,0) datatype setting in MySQL for all monetary values. Is this for math calculation simplicity? Then do would again use CSS to format the value and control the decimal place to display as $0.00 in the catalogue?

Sign in to reply to this post

biesheuvel378713

Storing text with HTML mark up is in most times considered as "bad coding practices".

On first hand it may look tempting, if you pull data out of de DB you only have to declare the CSS classes and voila, done....


But what if you want to present your data in a different way? For instance, you want to change a table into an unordered list? If you only have twenty records or so its not a problem, but what if you have thousands of records?

If you want to add HTML markup to your data you must do that if, and only if, you are very certain this data will only be used as text, but after several years it might happen that no one remembers how to define the css for those chunks of data...

And what if your database has grown to thousands and thousand of records with HTML code and after several years certain tags become deprecated? Or even worse, new standards with better presentation features have emerged, then you are tight down to old fashioned standards...


Second of all, if you have data that can be presented in tables it looks like you have to store that in a seperate record and relate those records with key columns. That's the power of a relational database!

Keep in mind that if you store data using HTML tags to seperate values you are mixing the DAL (Data Acces Layer) with the presentation layer.

Believe me, it's bad coding practice not to tease us pour web developers, no it's to help us create flexible maintainable web applications.




-----
Why use decimal values for currency, because data itself must describe what it is.

CSS is pure presentation layer...

Greets...

Sign in to reply to this post

Justin Nemeth

I agree, the database should just store the data. Your php (or whatever language) page would then query the db and create the HTML for you. This is way more flexible to change at a later time. This leaves your data nice in the database.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...