HELP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • news.blueyonder.co.uk

    HELP

    hi,
    i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products
    webpage using both HTML and PHP. The system works where:
    - The File Connects & Logs on to the sql database and selects appropriate
    table
    - file searches database in specified column using a defined variable

    however when i put in the variable "hard drives" it gives me the list of
    hard drives all in 1 table cell causing it to mangle up, is there any way
    that i can get each product to go down into each cell?

    If you want to view the page the link is http://82.42.112.231/connect.php

    Any help would be greatly appreciated

    shaun


  • Kartic

    #2
    Re: HELP

    Shaun,

    Without your code, it will be difficult to pinpoint the exact error but
    let me try...

    It appears that when you read your query results from MySQL, you are
    not creating a new table row for each row your read (<tr>... </tr>).
    Instead you are looping through your result set producing multiple
    <td></td> for each row read into the same <tr></tr>.

    What you want is this:
    <table>
    <!-- Loop here by row -->
    <tr>
    <!-- Loop here by column -->
    <td>item 1 Description Value</td>
    <td>item 1 Price Value</td>
    <td>item 1 Price With VAT</td>
    </tr>
    <tr>
    <td>item 2 Description Value</td>
    <td>item 2 Price Value</td>
    <td>item 2 Price With VAT</td>
    </tr>
    .....
    </table>

    So in PHP, it will be:
    <table>
    <?php
    while ($row = mysql_fetch_row ($queryid)) {
    ?>
    <tr>
    <td><?=$row['item_desc'];?></td>
    <td><?=$row['item_price_nov at'];?></td>
    <td><?=$row['item_price_vat '];?></td>
    </tr>
    <?php
    } // End while()
    ?>
    </table>

    (if you want a generalized solution, you can put the <td></td> part in
    a loop too, this time looping over the columns.
    Hope that helped.
    --Kartic

    Comment

    • News Me

      #3
      Re: HELP

      news.blueyonder .co.uk wrote:[color=blue]
      > hi,
      > i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products
      > webpage using both HTML and PHP. The system works where:
      > - The File Connects & Logs on to the sql database and selects appropriate
      > table
      > - file searches database in specified column using a defined variable
      >
      > however when i put in the variable "hard drives" it gives me the list of
      > hard drives all in 1 table cell causing it to mangle up, is there any way
      > that i can get each product to go down into each cell?
      >
      > If you want to view the page the link is http://82.42.112.231/connect.php
      >
      > Any help would be greatly appreciated
      >
      > shaun
      >
      >[/color]

      It's kinda tough to guess what's wrong with your code when all we can
      see is its output. Need to see connect.php.

      NM

      --
      convert uppercase WORDS to single keystrokes to reply

      Comment

      • Shaun Rigby

        #4
        Re: HELP

        OK, av managed to get it to go across the page with the relevant info, what
        code can i use to get it on the next row?

        "News Me" <newsTWOme@paci fierDOTcom> wrote in message
        news:10u1fhk2va bjh4a@corp.supe rnews.com...[color=blue]
        > news.blueyonder .co.uk wrote:[color=green]
        >> hi,
        >> i am using Apache, with PHP 4.3.10, and MySQL, i am creating a products
        >> webpage using both HTML and PHP. The system works where:
        >> - The File Connects & Logs on to the sql database and selects appropriate
        >> table
        >> - file searches database in specified column using a defined variable
        >>
        >> however when i put in the variable "hard drives" it gives me the list of
        >> hard drives all in 1 table cell causing it to mangle up, is there any way
        >> that i can get each product to go down into each cell?
        >>
        >> If you want to view the page the link is http://82.42.112.231/connect.php
        >>
        >> Any help would be greatly appreciated
        >>
        >> shaun[/color]
        >
        > It's kinda tough to guess what's wrong with your code when all we can see
        > is its output. Need to see connect.php.
        >
        > NM
        >
        > --
        > convert uppercase WORDS to single keystrokes to reply[/color]


        Comment

        • Alan

          #5
          Re: HELP

          On Sun, 09 Jan 2005 05:36:40 GMT, "Shaun Rigby"
          <shaunrigby16@h otmail.com> wrote:
          [color=blue]
          >OK, av managed to get it to go across the page with the relevant info, what
          >code can i use to get it on the next row?
          >[/color]

          Without seeing your "real" php code it's hard to say, but basically
          when you have read enough fields/items for a row then do a </tr> <tr>
          and read the next lot of fields/items. Don't forget if an field is
          blank it still needs a field in your database.

          Alan


          --
          +++++++++++++++ +++++++++++++++ ++++++++++++
          Jenal Communications
          Manufacturers and Suppliers of HF Selcall
          P O Box 1108, Morley, WA, 6943
          Tel: +61 8 9370 5533 Fax +61 8 9467 6146
          Web Site: http://www.jenal.com
          Contact: http://www.jenal.com/?p=1
          +++++++++++++++ +++++++++++++++ ++++++++++++

          Comment

          Working...