Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member jf1288's Avatar
    Join Date
    Sep 2003
    Posts
    215
    Member #
    3300
    I have a database, $products, with one table, $product_list. This table has a whole lot of rows in it, but i dont know how many because it changes. I want to print the contents of the 'name' column for each row where the 'category' colunm = 1, and then follow the name with a break line. I have looked at some tutorials, and i have no idea how to formulate this.


    Any help?
    If its not in Family Guy its not worth it.

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    If I understand you correctly, this should do the trick:
    PHP Code:
    <html>
    <head>
     <title>Contents of db</title>
    </head>
    <body>
    <table border=0 cellpadding=0 cellspacing=0><?php
     $sql 
    "SELECT `name` FROM `products_list` WHERE `category`='1';";
     
    // set up your db connection here
     
    $result mysql_query($sql,$conn) or die ("Query error: " mysql_error());
     while (
    $tmp mysql_fetch_array($result)) {
      echo 
    "
     <tr>
      <td>
    $tmp[0]</td>
     </tr>
    "
    ;
     }
    ?></table>
    </body>
    </html>
    - Brian

  4. #3
    Senior Member jf1288's Avatar
    Join Date
    Sep 2003
    Posts
    215
    Member #
    3300
    awsome, thanks
    If its not in Family Guy its not worth it.

  5. #4
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    No problem.
    - Brian


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:13 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com