HTML into MYSQL is recommended ?

BigStack

Newbie
Joined
Dec 10, 2013
Messages
9
Reaction score
0
Hello,


I'm working on my first website and I need to know more opinions regarding importing HTML code into MYSQL database.
I will not put sophisticated HTML code, I only use basic commands like bold, br, italic, etc. to give the text article a good shape look.


So what you recommend?


Thanks for any reply.
 
HTML into SQL? is that even possible?

Put HTML into your page not into your database i see no reason for doing what you want to do, and 99% sure is not even possible
 
It will give you less control over your data. Store what data needs to be stored and manipulate it with css on the front end for easy on the fly changes
 
HTML into SQL? is that even possible?


Put HTML into your page not into your database i see no reason for doing what you want to do, and 99% sure is not even possible
Yeap, it is possible! Do google for "insert html code in mysql" and you get relevant results, my question is if it recommended :)

It will give you less control over your data. Store what data needs to be stored and manipulate it with css on the front end for easy on the fly changes
The HTML code that I want to insert to mysql is part of a page content and it will be something like this:

<p>The<strong>iPhone 2</strong> been fabricated between 2003 and 2007. </ br> This period <strong>Apple</strong> sold about x products.</p>

So will that affect the host server speed activity ?
 
Last edited:
Or what's the best way to insert static content on a dynamic page ?
 
I don't get it. There is no need to store HTML code at Databases so your text can have a better shape look.
 
Nope, not recommended albeit doable
An analogy, "You can put install Diablo II into an old computer but results are as expected"
Utilize SQL Language in MySQL for optimal performance

2 cents worth and Good Luck
 
Have we never heard of a little thing called a Cascading Style Sheet? A language developed for this exact purpose?
 
You can definitely do that and many templates are using this approach. For example you can then create custom admin dashboard where you can pull the content from db, edit the content and get changes live to your site when you save it.
 
Its very easy, just use str_replace("\r\n","",stripslashes($_POST['$your_string']));

Ive used it on many of my sites - this is taken from wordpress and buddypress:

function settings_screen_save( $group_id ) {
$setting = '';

if ( isset( $_POST['group_extension_example_1_setting'] ) ) {
$setting = str_replace("\r\n","",stripslashes($_POST['group_extension_example_1_setting']));
}

groups_update_groupmeta( $group_id, 'group_extension_example_1_setting', $setting );
}
 
Back
Top