MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 21st, 2003, 04:11 AM
MarnixK MarnixK is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 MarnixK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[mysql] temporary table problem

I tried to make a movie top 10 on my page with the help of php and mysql. I want a movie to show up after it received at least 5 votes. I tested the code offline on my laptop running omnihttp en mysql. All seemed to work just fine until I uploaded the thing to test it online. Online it's it creating a way of it's own, I just don't know what is does.

I use the following code :
$now = time();
$now = contract_days($now,30);
$query = db_query("CREATE TEMPORARY TABLE top10");
$query = db_query("INSERT INTO top10 SELECT distinct(filmid) FROM biosfilms WHERE (datum>$nu)");
$select = "select sneakpoints.*, count(cijfer)/3 as aantal,sum(cijfer)/count(cijfer) as cijfer from sneakpoints,top10 where (top10.filmid = sneakpoints.filmid) group by sneakpoints.filmid having (aantal>4) order by cijfer desc limit 10";

What goes wrong ?? Do I have to create a different temp. table for each user, or should i work also with the above code ??

Reply With Quote
  #2  
Old June 21st, 2003, 02:05 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
I'm not exactly sure what you are trying to do from the looks of this code...

I'd suggest looking at each piece and deciding if it makes sense.
Take a look at this... I don't think this is serving any purpose as you have what looks like it is supposed to be one query, but the second line is overwritting the first.

Code:
$query = db_query("CREATE TEMPORARY TABLE top10"); 
$query = db_query("INSERT INTO top10 SELECT distinct(filmid) FROM biosfilms WHERE (datum>$nu)"); 


Essentially, if you execute the query that is in the $query variable you will never execute the CREATE TEMPORARY TABLE portion.

You need to either:

1. create a new variable to hold each query
2. concatenate the strings so that each query runs in succession
3. or use a an array to hold the queries.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > [mysql] temporary table problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway