Two tables combining

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RotterdamStudents

    Two tables combining

    Hi all,

    i'm trying to combine stuff from table a and table b in one page. I tried
    something with array_combine but it didn't work.

    Can someone help me out with the necessary piece of code ??

    Thanx

    Martijn


  • windandwaves

    #2
    Re: Two tables combining


    "RotterdamStude nts" <NOSPAMnewsNOSP AM@MAPSONcistro n.nederland> wrote in message news:cv9sas$9sq $1@news.cistron .nl...[color=blue]
    > Hi all,
    >
    > i'm trying to combine stuff from table a and table b in one page. I tried
    > something with array_combine but it didn't work.
    >
    > Can someone help me out with the necessary piece of code ??
    >
    > Thanx
    >
    > Martijn
    >
    >[/color]

    Hoi Martijn

    Try Union, at least if you are using MySql



    Groet

    - Nicolaas


    Comment

    • Armando Padilla

      #3
      Re: Two tables combining

      windandwaves wrote:[color=blue]
      > "RotterdamStude nts" <NOSPAMnewsNOSP AM@MAPSONcistro n.nederland> wrote in message news:cv9sas$9sq $1@news.cistron .nl...
      >[color=green]
      >>Hi all,
      >>
      >>i'm trying to combine stuff from table a and table b in one page. I tried
      >>something with array_combine but it didn't work.
      >>
      >>Can someone help me out with the necessary piece of code ??
      >>
      >>Thanx
      >>
      >>Martijn
      >>
      >>[/color]
      >
      >
      > Hoi Martijn
      >
      > Try Union, at least if you are using MySql
      >
      > http://dev.mysql.com/doc/mysql/en/union.html
      >
      > Groet
      >
      > - Nicolaas
      >
      >[/color]
      Hey

      SELECT * FROM TABLE_A, TABLE_B WHERE TABLEA.SOMEID = TABLE_B.SOMEID

      or

      SELECT * FROM TABLE_A INNER JOIN TABLE_B ON TABLE_A.SOMEID = TABLE_B.SOMEID

      no if you want to pass all that info into an array so you can hadle it
      later do the below.


      $array = array();
      $i = 0;
      while($getInfo = mysql_fetch_arr ay($RESULTS)){

      for($j=0; $j<mysql_num_fi elds($RESULTS); $j++ ){
      $array[$i][$j] = $getInfo[$j];
      }

      $i++;
      }

      the above code returns a multidimensiona l array with all the info that
      we received from the database.

      Hope that helps
      Armando Padilla

      Comment

      Working...