List:General Discussion« Previous MessageNext Message »
From:cristian ditoiu Date:June 10 2002 9:23pm
Subject:Re: php+mysql+multiple lines qry
View as plain text  
can't insert into questions( ) select from questions .
the error  is : not unique table or alias .
tried with insert into ... select a.field1 , a.filed2 from questions as a .
not working ;)

----- Original Message -----
From: "Brent Baisley" <brent@stripped>
To: "cristian ditoiu" <cristian.ditoiu@stripped>;
<mysql@stripped>
Sent: Monday, June 10, 2002 10:53 PM
Subject: Re: php+mysql+multiple lines qry


> Why not just use something like:
> insert into questions (field1,field2,...) select...
>
> You don't need to create temp tables for your data and all the other
> complicated stuff.
>
> > hello .
> > i use php 4.12 + mysql 3.23.49  on linux .
> > i've developed a online testing(quiz) -aplication that now is expected
to
> > behave somehow different from what i've had in mind at the begining .
More
> > exactly :
> >
> > i have 3 tables (MyIsam):
> >
> > 1.     tests (id,name,desc)
> > 2.     questions (id,id_test_fk,desc)
> > 3.     answer(id,id_q_fk,desc,points) .
> >
> > i want to copy a question from one test to another .
> > If i knew that from the start , i would have designed the tables
differntly
> > , but that's another problem .
> > the point is i'm trying to do a 'quick_and_dirty' patch like this :
> > ----------
> > set @test_id=$test_target;
> > set @q_id=$qid;
> >
> > create temporary table q_temp as select * from questions;
> > create temporary table ans_temp as select * from answers;
> >
> > 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;
> > ------
> > where $test_target and $qid are  given from php .
> >
> > my problem is that this query works and dows what is expected when run
from
> > mysql ,
> > but NOT from php . No error , nada . I even tryed to do dirty thing
> > (shell_exec('mysql -u user -p password database </tmp/qry.txt')) where
> > qry.txt was generated
> > by php (containing the above code) but NO luck .
> > could you please give a suggestion or ..smth ?
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >  http://www.mysql.com/manual.php   (the manual)
> >  http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <mysql-thread111509@stripped>
> > To unsubscribe, e-mail
<mysql-unsubscribe-brent=landover.com@stripped>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
>
> --
> Brent Baisley
> Systems Architect
> Landover Associates, Inc.
> Search & Advisory Services for Advanced Technology Environments
> p: 212.759.6400/800.759.0577

Thread
Maximum JOINED tablesArthur Fuller5 Jun
  • Re: Maximum JOINED tablesRoger Baklund5 Jun
RE: Maximum JOINED tablesWalt Weaver5 Jun
  • RE: Maximum JOINED tablesAndrew Hazen5 Jun
RE: Maximum JOINED tablesWalt Weaver5 Jun
RE: Maximum JOINED tablesWalt Weaver5 Jun
  • Re: Maximum JOINED tablesSabine Richter5 Jun
    • Re: Maximum JOINED tablesDan Nelson5 Jun
  • Re: Maximum JOINED tablesRoger Baklund5 Jun
    • Re: Maximum JOINED tablesHarald Fuchs6 Jun
      • RE: Maximum JOINED tablesRoger Baklund6 Jun
        • Re: RE: Maximum JOINED tablesVictoria Reznichenko6 Jun
          • Re: Maximum JOINED tablesRoger Baklund6 Jun
            • Re: Maximum JOINED tablesBenjamin Pflugmann7 Jun
              • Re: Maximum JOINED tablesRoger Baklund7 Jun
                • Re: Re: Maximum JOINED tablesVictoria Reznichenko7 Jun
                  • Re: Maximum JOINED tablesRoger Baklund7 Jun
                • Re: Maximum JOINED tablesBenjamin Pflugmann7 Jun
                  • Re: Maximum JOINED tablesRoger Baklund8 Jun
                    • Not using indexes???Jon Frisby8 Jun
                      • Re: Not using indexes???Erv Young8 Jun
                      • Re: Not using indexes???bvyas38 Jun
                        • RE: Not using indexes???Jon Frisby8 Jun
                          • Re: Not using indexes???Benjamin Pflugmann8 Jun
                            • Re: Not using indexes???Erv Young10 Jun
                            • RE: Not using indexes???Jon Frisby10 Jun
                              • php+mysql+multiple lines qrycristian ditoiu10 Jun
                                • Re: php+mysql+multiple lines qryBrent Baisley10 Jun
                                  • Re: php+mysql+multiple lines qrycristian ditoiu10 Jun