SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Syntax

  1. #1
    SitePoint Member
    Join Date
    Nov 2001
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Syntax

    Hi all
    I have the following tables in my database
    Table1..ID..Name, Table2..ID..Name,Table3..ID..Name,Table4..ID..Name,Table5..ID..Name, Table6..ID..Name Table7 IDTable1..IDTable2..IDtable3..IDTable4..IDtable5..IDtable6
    I have been trying all afternoon to get the correct syntax to display all of the data. But as yet not found it ...Any offers of help? Thats provided you understand what I have typed!
    Regards
    Keith

  2. #2
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    what dB and language are you using? php & mysql??

    And you want to select all of the data from each table and display in your browser?

    if I am right and that is what you want then the code would something like this:

    PHP Code:
    $sql "select 
        Table1.ID as ID1,
        Table1.Name as Name1, 
        Table2.ID as ID2,
        Table2.Name as Name2,
        Table3.ID as ID3,
        Table3.Name as Name3,
        Table4.ID as ID4,
        Table4.Name as Name4,
        Table5.ID as ID5,
        Table5.Name as Name5,
        Table6.ID as ID6,
        Table6.Name as Name6,
        IDTable1,
        IDTable2,
        IDTable3,
        IDTable4,
        IDTable5,
        IDTable6
            from 
        Table1, Table2, Table3, Table4, Table5, Table6, Table7"
    ;
    $result mysql_query($sql);
    if (!
    $result) {
      echo(
    "<p class=red>Error retrieving data from database! ".
           
    "Error: " mysql_error() . "</p>");
      exit();
    }

    while (
    $result mysql_fetch_array($row)) {
      
    $ID1 $row["ID1"];
      
    $ID2 $row["ID2"];
      
    $ID3 $row["ID3"];
      
    $ID4 $row["ID4"];
      
    $ID5 $row["ID5"];
      
    $ID6 $row["ID6"];
      
    $Name1 $row["Name1"];
      
    $Name2 $row["Name2"];
      
    $Name3 $row["Name3"];
      
    $Name4 $row["Name4"];
      
    $Name5 $row["Name5"];
      
    $Name6 $row["Name6"];
      
    $IDTable1 $row["IDTable1"];
      
    $IDTable2 $row["IDTable2"];
      
    $IDTable3 $row["IDTable3"];
      
    $IDTable4 $row["IDTable4"];
      
    $IDTable5 $row["IDTable5"];
      
    $IDTable6 $row["IDTable6"];

    echo (
    "insert table here to display your data");


    Last edited by Sarah; Apr 5, 2002 at 10:04.
    Regular user

  3. #3
    SitePoint Member
    Join Date
    Nov 2001
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You a star thanks very much shall try it out later

    Oh PHP/MYSQL
    Shall let you know how i get on


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
  •