SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hlep Showing Data from Database online

    Hi;

    I have made a simple database for learning purpose and trying to put it online,

    and have a question regarding showing some data on line,

    The database I have made has totally 8 tables, ( Company, Name, Tel No, Fax No, Email, Address, Webpage, Category)



    Company: company_Id,



    Name: Name_Id , company_id

    Tel: Tel_Id, company_id

    Fax: fax_Id, company_id



    and so on for every table



    All these tables are related to each other and I have made a query as well and works fine, and show the data I have inserted. I have used MS Access 2000.



    The reason I have made tables instead of fields, is that one company may have more than one email address or phone number, and I don’t want to type everything all over again,

    Anyway, now the problem is when I put all these data on line in a webpage,

    If a company has 4 phone No and 2 email addresses, it appears 6 times, in a row as it should I believe.

    Can I somehow make it so that it does not show the repeated data all over again?, only in this case 4 phone No and 2 email addresses, and the rest of data only once.



    I don’t know, may be this is an odd question, maybe it is OK to have a repeated rows.

    I am trying to use Mysql and PHP, and I am new to these, I also use Dreamweaver MX.

    Your reply is appreciated.
    Thanx

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    when a query result set contains data in one-to-many relationships, you get the "one" field repeated "many" times

    what you are asking is to print the "one" field once and the "many" field many times, and you must do this in your scripting language, i.e. php in your case

    yes, it can be done with sql, but it is exceedingly ugly

    perhaps you could ask your question in the php forum, it is fairly common and you will likely get code samples there
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot r937'


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
  •