1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

HTML into MYSQL is recommended ?

Discussion in 'Blogging' started by BigStack, Dec 10, 2013.

  1. BigStack

    BigStack Newbie

    Joined:
    Dec 10, 2013
    Messages:
    9
    Likes Received:
    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.
     
  2. Jayar

    Jayar Junior Member

    Joined:
    May 19, 2010
    Messages:
    138
    Likes Received:
    43
    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
     
  3. HerpDerpSlerp

    HerpDerpSlerp Power Member

    Joined:
    Mar 19, 2013
    Messages:
    778
    Likes Received:
    623
    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
     
    • Thanks Thanks x 1
  4. BigStack

    BigStack Newbie

    Joined:
    Dec 10, 2013
    Messages:
    9
    Likes Received:
    0
    Yeap, it is possible! Do google for "insert html code in mysql" and you get relevant results, my question is if it recommended :)

    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: Dec 10, 2013
  5. BigStack

    BigStack Newbie

    Joined:
    Dec 10, 2013
    Messages:
    9
    Likes Received:
    0
    Or what's the best way to insert static content on a dynamic page ?
     
  6. kanun

    kanun Newbie

    Joined:
    Nov 2, 2013
    Messages:
    15
    Likes Received:
    0
    Occupation:
    Web Development
    I don't get it. There is no need to store HTML code at Databases so your text can have a better shape look.
     
  7. Commoner

    Commoner Power Member

    Joined:
    Dec 8, 2013
    Messages:
    745
    Likes Received:
    160
    Occupation:
    Analyst
    Location:
    SG
    Home Page:
    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
     
  8. pxoxrxn

    pxoxrxn Supreme Member

    Joined:
    Dec 21, 2011
    Messages:
    1,397
    Likes Received:
    2,066
    Have we never heard of a little thing called a Cascading Style Sheet? A language developed for this exact purpose?
     
  9. laowai

    laowai Power Member

    Joined:
    Feb 27, 2011
    Messages:
    522
    Likes Received:
    184
    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.
     
  10. aimadnet

    aimadnet Newbie

    Joined:
    Aug 13, 2011
    Messages:
    30
    Likes Received:
    3
    Occupation:
    Web Developer
    Location:
    Nowhere
    No it's not recommended :)
     
  11. Nit3watch

    Nit3watch Registered Member

    Joined:
    Jun 13, 2012
    Messages:
    54
    Likes Received:
    14
    Location:
    South Africa
    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 );
    }