Welcome to WebmasterWorld Guest from 188.8.131.52
Im stuck with this one, will try to explain.
I need to run a mysql query and put the results in some sort of variable where i can use them again.
select * from table
id = 1 colour = red
id = 2 colour = blue
id = 3 colour = green
then i have a script that does:
select * from table2
colour id = 2
iwould like to say colour = blue without running the first query over over as its nearly 1000 times
It can probablt be done with a join but ive yet to understand joins fully
Its late im tired applogies if no one understands
SELECT table2.color_id, table.color FROM table, table2 WHERE table.id=table2.color_id;
Start with simple WHERE, then you will understand JOINs
As I recall the difference is that join may be faster.
You can check that by running explain:
EXPLAIN SELECT table2.color_id, table.color FROM table, table2 WHERE table.id=table2.color_id;
EXPLAIN SELECT table2.color_id, table.color FROM table2 LEFT OUTER JOIN table ON table.id=table2.color_id;