Question about displaying MySQLl data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • L C

    Question about displaying MySQLl data

    Hello,

    Could someone point in the correct direction with regards to displaying my
    data in "nicer" format. I have figured out ( with the tutorials on the web,
    and the O'Reilly PHP & MySQL book) how to store, retrieve, manipulate, and
    display my data using PHP. But when I do display, it is the block format.
    I can't seem to find a tutorial that gets into a "prettier" type of display.

    Is this a HTML issue?

    I am a newbie to this stuff

    Any help or direction is much appreciated.

    Larry C


  • =?ISO-8859-15?Q?Iv=E1n_S=E1nchez_Ortega?=

    #2
    Re: Question about displaying MySQLl data

    L C wrote:
    But when I do display, it is the block format.
    What do you exactly mean by this? Are you outputting paragraphs of text with
    no line breaks? (hint: http://php.net/nl2br)

    --
    ----------------------------------
    Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-


    Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and PHP
    5.2.3-1 generating this signature.
    Uptime: 16:42:36 up 13 days, 22:44, 3 users, load average: 1.77, 1.27,
    1.22

    Comment

    • L C

      #3
      Re: Question about displaying MySQLl data


      "Iván Sánchez Ortega" <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
      wrote in message news:f4rk1m$vt1 $1@hercules.coh p1...
      L C wrote:
      >
      But when I do display, it is the block format.
      >
      What do you exactly mean by this? Are you outputting paragraphs of text
      with
      no line breaks? (hint: http://php.net/nl2br)
      >
      --
      ----------------------------------
      Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
      >

      Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and
      PHP
      5.2.3-1 generating this signature.
      Uptime: 16:42:36 up 13 days, 22:44, 3 users, load average: 1.77, 1.27,
      1.22
      >
      I am outputting tables. The stuff I am doing is for a golf league. If I
      output scores it comes out like this.

      member_id week hole_1 hole_2 hole_3 hole_4 hole_5 hole_6 hole_7 hole_8
      hole_9 total
      13 4 6 4 6 5 6 4 5 4 5 45
      12 4 7 5 5 5 7 5 5 4 4 47
      21 4 6 4 5 5 8 7 6 6 4 51
      14 4 5 4 7 5 8 4 7 4 4 48
      19 4 6 6 5 4 8 5 6 4 5 49
      20 4 4 5 8 5 7 5 6 3 3 48



      I am trying to get it to look better

      Larry C


      Comment

      • =?ISO-8859-15?Q?Iv=E1n_S=E1nchez_Ortega?=

        #4
        Re: Question about displaying MySQLl data

        L C wrote:
        I am outputting tables. The stuff I am doing is for a golf league. If I
        output scores it comes out like this.
        Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
        where appropiate.

        --
        ----------------------------------
        Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-


        Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and PHP
        5.2.3-1 generating this signature.
        Uptime: 17:12:19 up 13 days, 23:14, 3 users, load average: 3.50, 2.67,
        2.03

        Comment

        • L C

          #5
          Re: Question about displaying MySQLl data


          "Iván Sánchez Ortega" <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
          wrote in message news:f4rloi$1b4 $1@hercules.coh p1...
          L C wrote:
          >
          I am outputting tables. The stuff I am doing is for a golf league. If
          I
          output scores it comes out like this.
          >
          Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
          where appropiate.
          >
          --
          ----------------------------------
          Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
          >

          Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and
          PHP
          5.2.3-1 generating this signature.
          Uptime: 17:12:19 up 13 days, 23:14, 3 users, load average: 3.50, 2.67,
          2.03
          >
          RTFM?

          Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
          where appropiate

          Like This?

          echo "<table border='1'><tr> ";
          // printing table headers
          for($i=0;
          $i<$fields_num; $i++){ $field = mysql_fetch_fie ld($result);
          echo "<td>{$fiel d->name}</td>";}echo "</tr>\n";
          // printing table rows
          while($row = mysql_fetch_row ($result)){ echo "<tr>";
          // $row is array... foreach( .. ) puts every element
          // of $row to $cell variable
          foreach($row as $cell)
          echo "<td>$cell</td>";
          echo "</tr>\n";
          }
          mysql_free_resu lt($result);
          ?>
          </body></html>

          I have RTFMed my way to this point. A week ago I didn't have PHP, MySQL, or
          IIS installed on my system. I didn't ask some generic question like: "How
          do I get PHP". I asked what I thought was a relatively specific question
          after searching the web for answers. I did search for PHP, MySQL, and
          format. I got many hits about date formats. Unfortunately, unlike you, I
          wasn't born knowing everything, I had to ask questions along the way. I am
          sorry I bothered you with my question.



          Comment

          • Jerry Stuckle

            #6
            Re: Question about displaying MySQLl data

            L C wrote:
            "Iván Sánchez Ortega" <ivansanchez-alg@rroba-escomposlinux.-.punto.-.org>
            wrote in message news:f4rloi$1b4 $1@hercules.coh p1...
            >L C wrote:
            >>
            >>I am outputting tables. The stuff I am doing is for a golf league. If
            I
            >>output scores it comes out like this.
            >Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
            >where appropiate.
            >>
            >--
            >----------------------------------
            >Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
            >>
            >http://acm.asoc.fi.upm.es/~mr/
            >Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE 3.5.7, and
            PHP
            >5.2.3-1 generating this signature.
            >Uptime: 17:12:19 up 13 days, 23:14, 3 users, load average: 3.50, 2.67,
            >2.03
            >>
            >
            RTFM?
            >
            Loop through the results (RTFM!), outputting "<table>", "<tr>" and "<td>"
            where appropiate
            >
            Like This?
            >
            echo "<table border='1'><tr> ";
            // printing table headers
            for($i=0;
            $i<$fields_num; $i++){ $field = mysql_fetch_fie ld($result);
            echo "<td>{$fiel d->name}</td>";}echo "</tr>\n";
            // printing table rows
            while($row = mysql_fetch_row ($result)){ echo "<tr>";
            // $row is array... foreach( .. ) puts every element
            // of $row to $cell variable
            foreach($row as $cell)
            echo "<td>$cell</td>";
            echo "</tr>\n";
            }
            mysql_free_resu lt($result);
            ?>
            </body></html>
            >
            I have RTFMed my way to this point. A week ago I didn't have PHP, MySQL, or
            IIS installed on my system. I didn't ask some generic question like: "How
            do I get PHP". I asked what I thought was a relatively specific question
            after searching the web for answers. I did search for PHP, MySQL, and
            format. I got many hits about date formats. Unfortunately, unlike you, I
            wasn't born knowing everything, I had to ask questions along the way. I am
            sorry I bothered you with my question.
            >
            >
            >
            Yes, that's the right idea, although you can clean it up a little, i.e.

            echo "<table border='1'><tr> ";
            // printing table headers

            for($i=0; $i<$fields_num; $i++){
            $field = mysql_fetch_fie ld($result);
            echo "<td>{$fiel d->name}</td>";
            }
            echo "</tr>\n";

            // printing table rows
            while($row = mysql_fetch_row ($result)){
            echo "<tr>";
            // $row is array... foreach( .. ) puts every element
            // of $row to $cell variable
            foreach($row as $cell)
            echo "<td>$cell</td>";
            echo "</tr>\n";
            }
            mysql_free_resu lt($result);
            ?>

            And yes, when you're new it's sometimes hard to get a handle on what you
            need. I'd suggest visiting the bookstore and getting a decent book on
            PHP and MySQl. While you're at it, you could look for one on HTML if
            you feel a need.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            Working...