DOH, I always figure it out after I post to the mailing list, the user didn't have create table privileges, that's why it didn't persist in my first attempt to do this with separate queries.
On Mon, 2002-02-25 at 10:34, Jeff Bearer wrote: > Hello, > > I'm trying to use a temporary table in mySQL with PHP. First I tried to > create a temporary table and then query it in the same script. But the > table didn't persist to the second query in the PHP script. > > I found this knowledge base entry: > http://www.faqts.com/knowledge_base/view.phtml/aid/445 > > Where it shows to do all the querying in one swoop. The problem I'm > having now is that PHP is throwing an error at the first semi-colon. It > appears that it doesn't want to run multiple query statements in 1 query > function. > > I'm using the mySQL pear class in my application, I wouldn't think that > it would have any effect on the problem. > > Here is an example of the query I'm attempting. > > CREATE TEMPORARY TABLE tmp_events SELECT event_id, event_title FROM > events; INSERT INTO tmp_events SELECT event_id, event_title FROM > special_events; SELECT event_id, event_title FROM tmp_events ORDER BY > event_title; > > But I get an error like: > 1064: You have an error in your SQL syntax near '; INSERT INTO > tmp_events' > > > If I echo my SQL statement and paste it into mySQL the query works fine. > Any suggestions that you can offer would be great. > > > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php