|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
[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 ?? |
|
#2
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > [mysql] temporary table problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|