www.webdeveloper.com
Results 1 to 2 of 2

Thread: result query printed in columns

  1. #1
    Join Date
    Apr 2005
    Posts
    90

    result query printed in columns

    whats goin on guys???... i wanted to know how to print a query within columns. I want to have 3 columns named First Last and Email and under those columns will be the printed result of the seach. Right now my code doesnt have the columns but print in a row. I still want the row set-up but would like the 3 column names on top.

    thanks in advance

    here is my code
    PHP Code:
    while ($rowmysql_fetch_array($result)) {
      
    $title $row["Email"];
      
    $title2 $row["Last_Name"];
      
    $title3 $row["First_Name"];

      echo 
    "$count.) $title $title2 $title3 <br>";
      
    $count++ ;
      } 

  2. #2
    Join Date
    Jan 2003
    Location
    VA
    Posts
    419
    HTML Code:
    <table>
    <tr>
    <td>
    num
    </td>
    <td>First Name</td>
    <td>Last Name</td>
    </tr>
    Code:
    <?php
    $sql = "your_select_here";
    $sql = mysql_query($sql) or die(mysql_error());
    $i = 0;
    while ($row = mysql_fetch_array($sql)){
         echo '<tr><td>' . $i . '</td><td>' . $sql['First_Name'] . '</td><td>' . $sql['Last_Name'] . '</td></tr>';
         $i++;
    }
    ?>
    HTML Code:
    </table>
    If for some reason it doesn't work, the "OR DIE(MYSQL_ERROR());", will always tell you whats up.

    Hope this helps.
    Cornflakes mmmm yummy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles