SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wanting to go from a 2 column report to a 4 column one

    Hi folks, I probably used the term 'report' incorrectly. Sorry for that in advance.

    The below code produces a 2 column web page that shows in the first column a picture and the 2nd column shows the person's name and address ad a few other things.

    What I would like is to change this into a 4 column report with no duplication in records.

    Could somebody help me with this, I'm sure it's simple enough but when your new to programming it all looks difficult.

    Thanks for your assistance.


    <?php require_once('Connections/buddies.php'); ?>
    <?php
    mysql_select_db($database_buddies, $buddies);
    $query_testrecordset = "SELECT id, first_name, last_name, address_1, address_2, city, `state`, zipcode, homeemail,workemail, photo_large FROM contact ORDER BY last_name";
    $testrecordset = mysql_query($query_testrecordset, $buddies) or die(mysql_error());
    $row_testrecordset = mysql_fetch_assoc($testrecordset);
    $totalRows_testrecordset = mysql_num_rows($testrecordset);
    ?>
    <style type="text/css">
    <!--
    .style2 {color: #000000}
    .style3 {font-weight: bold; font-size: 14px; font-family: Arial, Helvetica, sans-serif;}
    .style4 {font-weight: bold; font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif color: #CC0000};
    .style5 { font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #0000FF;}

    body {
    background-image: url(images/buddy/gradient23550953.png);
    background-repeat: repeat-x;
    background-attachment: fixed;
    }
    -->
    </style>
    </head>
    <body>
    <p align="left" class="style3">Dive Buddies </p>
    <a href="http://localhost/scuba/index.html">Home</a>
    <a href="http://localhost/scuba/contactinput.php">Add a Dive Buddy,</a>

    <table width="450" height="110" border="2" cellpadding="5" bgcolor="#000000">
    <?php do { ?>
    <tr>
    <td width="79" height="107" bordercolor="#FFFFFF" bgcolor="#AA0000"><img src="/scuba/images/buddy/<?php echo $row_testrecordset['photo_large']; ?>" alt="<?php echo $row_testrecordset['first_name']; ?>"></td>
    <td width="300" bgcolor="#FFFFFF"><p align="right" class="style3"><span class="style3"><?php echo $row_testrecordset['first_name']; ?> <?php echo $row_testrecordset['last_name']; ?><br>
    <?php echo $row_testrecordset['address_1']; ?> <br>
    <?php echo $row_testrecordset['address_2']; ?> <br>
    <?php echo $row_testrecordset['city']; ?> <?php echo $row_testrecordset['state']; ?><br>
    <?php echo $row_testrecordset['zipcode']; ?></span><br>
    <?php echo $row_testrecordset['homeemail']; ?></span><br>
    <?php echo $row_testrecordset['workemail']; ?></span><br>
    <p align="left" class="style5">Total Dives w/ this buddy: </p>

    <p>&nbsp;</p>
    <p>&nbsp; </p></td>
    </tr>

    <?php } while ($row_testrecordset = mysql_fetch_assoc($testrecordset)); ?>
    </table>
    <a href="http://localhost/scuba/index.html">Home</a>
    <a href="http://localhost/scuba/contactinput.php">Add a Dive Buddy,</a>
    <p><br>
    &nbsp;&nbsp;</p>
    </body></html>
    <?php
    mysql_free_result($testrecordset);
    ?>

  2. #2
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    umm all you really need to do is add in the extra table cells in your row, and copy and paste whatever values you want into it. eg.
    Code:
    <tr>
    <td><?php echo $row_testrecordset['address_1']; ?> <br>
    <?php echo $row_testrecordset['address_2']; ?></td>
    <td><?php echo $row_testrecordset['first_name']; ?> <?php echo $row_testrecordset['last_name']; ?></td>
    <td><?php echo $row_testrecordset['homeemail']; ?></td>
    </tr>
    if that makes sense?
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development


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
  •