jordangomm's Profile User Rating: -----

Reputation: 6 Worker
Group:
Contributors
Active Posts:
23 (0.01 per day)
Joined:
12-January 10
Profile Views:
1,964
Last Active:
User is offline Apr 01 2014 05:09 AM
Currently:
Offline

Previous Fields

Country:
ES
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Ford
Dream Kudos:
25

Latest Visitors

Icon   jordangomm has not set their status

Posts I've Made

  1. In Topic: getting value from database and printing with \n

    Posted 9 Dec 2012

    View PostAtli, on 08 December 2012 - 02:49 PM, said:

    View Postjordangomm, on 08 December 2012 - 08:53 PM, said:

    When storing your information to the database, convert new lines to HTML line breaks using:

    That's a bad idea. You don't taint the data by converting it to a specific output format before putting it into the database. You should store it in it's original form (or in some neutral form at least) and make whatever changes are required for it to fit your output when said output is being generated.


    Well said, didn't think that one through, although my second solution (the edit) changes on output, and also formats it into a list as the OP wanted, so that's probably more suited.
  2. In Topic: getting value from database and printing with \n

    Posted 8 Dec 2012

    EDIT: Removed my first solution, as pointed out by Atli, it was a bad idea. Try the solution below.

    Having further read your post I've noticed you wanted to display in a list, so you could also use this:

    $item_query = mysql_query("SELECT * FROM item"); 
    $row = mysql_fetch_assoc($item_query)
    $features_db = $row['features'];
    // Seperate the lines into array items using \n as the delimiter
    $features = explode("\n", $features_db);
    // Start the list
    echo "<ul>";
    // Loop through the features in the array we created
    foreach ($features as $f) {
    // Output each feature as a list item
    echo "<li>".$f."</li>";
    }
    // End the list
    echo "</ul>";
    
    

My Information

Member Title:
New D.I.C Head
Age:
19 years old
Birthday:
March 2, 1995
Gender:
Interests:
* Web Development
* Cycling
Full Name:
Jordan Gomm
Years Programming:
7
Programming Languages:
PHP, XHTML, JavaScript, CSS, XML, VB.NET, jQuery

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://www.runedesign.net
Twitter:
runedesign

Friends

jordangomm hasn't added any friends yet.

Comments

jordangomm has no profile comments yet. Why not say hello?