#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    12
    Rep Power
    0
    Hi,everyone
    I use PHP script to setup my tables application program.
    How to access temporary tables??

    mysql_select_db('train',$id_link);
    $str1="create temporary table mytable1 select * from train_time where station_name='$station_name1'";
    $str2="create temporary table mytable2 select * from train_time where station_name='$station_name2'";

    $result1=mysql_query($str1,$id_link);
    $result2=mysql_query($str2,$id_link);

    $str3="select mytable1.train_number mytable1.station_name
    mytable1.start_time mytable2.station_name from mytable1,mytable2
    where mytable1.train_number=mytable2.train_number and mytable1.key_train_time<mytable2.key_train_time";

    $result3=mysql_query($str3,$id_link)or die ("failed");

    The last result is :

    $result1=1
    $result2=1
    failed


    Thanks!

    [This message has been edited by sbwtxj (edited October 17, 2000).]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Redmond, WA
    Posts
    218
    Rep Power
    14
    The first problem I noticed was the fact you don't have commas in between the fields you want to retrieve.

    select mytable1.train_number, mytable1.station_name, etc. etc. should work.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    12
    Rep Power
    0
    Oh,i frogot that i have found and changed it.But the question is so.

    The command mysql_query using way is right?
    $str="select t1.col1,t1.col2,t1.col3,t2.col2,t2.col4 from train_time t1,train_time t2 where t1.name='$name1' and t2.name='$name2' and t1.number=t2.number";
    mysql_query($str,$id);

    the system alway appears error massages.

    I don't know this using way is right?

    Thanks!

Similar Threads

  1. Replies: 1
    Last Post: February 15th, 2004, 03:04 AM
  2. Replies: 1
    Last Post: February 15th, 2004, 02:45 AM
  3. tables get corrupted
    By 90coders in forum MySQL Help
    Replies: 1
    Last Post: December 5th, 2003, 05:23 AM
  4. Replies: 0
    Last Post: September 1st, 2003, 01:36 AM
  5. temporary tables, and copying records
    By brainfuelmedia in forum MySQL Help
    Replies: 0
    Last Post: July 31st, 2003, 05:01 PM

IMN logo majestic logo threadwatch logo seochat tools logo