SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2001
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, this is a really dumb question, but i cant figure it out...im a 3 days php newebie .

    i need to show the result of the query in column, but i get all the results but in a row.

    i want to display it like this:

    result1
    result2
    result3
    and so..

    and i get:

    result1result2result3result4.

    here is the little code.

    <?php

    $result = mysql_query(
    "SELECT KgBulto FROM fruta");
    if (!$result) {
    echo("<P>Error performing query: " .
    mysql_error() . "</P>");
    exit();
    }

    while ( $row = mysql_fetch_array($result) ) {
    echo( $row["KgBulto"]<br> );
    }
    ?>

    thanx in adv.
    my pet its bat...so what?

  2. #2
    SitePoint Addict Percipient's Avatar
    Join Date
    Jun 2000
    Location
    Summerland, BC, Canada.
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try changing...
    PHP Code:
    echo( $row["KgBulto"]<br> ); 
    to...
    PHP Code:
    echo $row["KgBulto"] . "<br>"
    Note the period, which tells PHP to join what's on either side of it together, and the quotes around the break tag.

    Also, the () are optional around an echo(), or the similair function of print().

    Additionally, if you want your outputted source code to look like...
    Code:
    result1<br>
    result2<br>
    result3<br>
    result4<br>
    instead of...
    Code:
    result1<br>result2<br>result3<br>result4<br>
    set your PHP code to...
    PHP Code:
    echo $row["KgBulto"] . "<br>\n"
    and you'll drop to a new line after each echo().
    Last edited by Percipient; Apr 25, 2001 at 10:06.
    Ed Rands

  3. #3
    SitePoint Member
    Join Date
    Apr 2001
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you very much my friend, that solved my prob.!!!
    my pet its bat...so what?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •