Question:

Can anyone here help me create a PHP script that would display a block of text in LIST form?

by Guest61634  |  earlier

0 LIKES UnLike

I have a mysql table which contains a record of composed of paragraphs and lists. Can anyone help me with a script that would detect and convert short text and display them with list (UL or LI) tags.

 Tags:

   Report

1 ANSWERS


  1. // Open unordered list. Replace with <ol> for ordered.

    echo "<ul>";

    // Make your query, make it an associative array.

    $query = mysql_query(...insert your query here...);

    // start count

    $c=0;

    // While loop for results

    while($lines = mysql_fetch_array($query, MYSQL_ASSOC)

    {

    // place your field name into a var - make new ones as required.

    $this_Value = mysql_result($query,$c,'database field name');

    // print the list elements.

    echo "<li>$this_Value</li>";

    // add to count and move through array.

    $c++;

    }

    // close (un)ordered list.

    echo "</ul>";

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.