> hello.. > i have a pretty wired query to do with php/mysql . > i don't manage to do > > mysql_query($qry,$connection); . > (query bellow) > > so i found a quick and dirty solution.see bellow . > but it's no realy elegant . > > any ideea how can i do multiple queries at once with mysql_query() ? > > function copy_question($qid,$test_target) { > global $connection,$username,$password,$database; > > > $fp = fopen ('/tmp/copy_table_qry', 'w'); > > $qry="create temporary table q_temp as select * from questions; > create temporary table ans_temp as select * from answers; > set @test_id=$test_target; > set @q_id=$qid; > insert into questions select > '',@test_id,t2.q_type,t2.description,t2.dimension,t2.combination,t2.checkit > from q_temp as t2 where id=@q_id; > select @last:=LAST_INSERT_ID(); > insert into answers select '',@last,score,description from ans_temp where > id_question_fk=@q_id;"; > > fputs($fp,"$qry"); > fclose($fp); > > $a=exec("/usr/bin/mysql -u $username -p$password $database > </tmp/copy_table_qry"); > -- > > thnx . > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php