SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with displaying information from a database

    HI

    I have a situation where I read information from a table and the results is a
    one to many situation.

    So I have 2 fields

    Client_id and Prod_id

    Now one client can order many products so how do I use PHP to display
    from the database the result..I have this for starters

    $sql ="SELECT * prod_id from sometable WHERE client_id =someclient";
    $result = @mysql_query($sql, $conn);
    while($newArray = mysql_fetch_array($result)) {
    echo "client_id=$newArray['client_id']"................


    How do I display the prod_id, since there will be more that one product

    Please help
    Niva

  2. #2
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    USA
    Posts
    633
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I may be wrong but I tink this works ...

    foreach(newArray['prod_id']as $products){
    blah blah blah .......



    Didi


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
  •