October 16th, 2000, 09:46 PM
I use PHP script to setup my tables application program.
How to access temporary tables??
$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'";
$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 :
[This message has been edited by sbwtxj (edited October 17, 2000).]
October 17th, 2000, 12:45 PM
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.
October 17th, 2000, 08:33 PM
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";
the system alway appears error massages.
I don't know this using way is right?