Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating a TEMPORARY table with PHP 1

Status
Not open for further replies.

webdev007

Programmer
Sep 9, 2005
168
How will you envision populating a TEMPORARY TABLE
With existing rows from a non TEMPORARY table?

I am not to sure about the best method.

What is the most efficient way?

Read the existing table in an ARRAY and loop through for inserting or …?

Thanks
 
Hi

webdev007 said:
What is the most efficient way?

Read the existing table in an ARRAY and loop through for inserting or …?
That is certainly not efficient. Solve it inside the MySQL server, without getting and putting the data :
Code:
mysql_query('insert into [green][i]the_temp_table[/i][/green] select * from [green][i]the_table[/i][/green]');

Feherke.
 
I would like adding that it works fine, and is fast.

Plus it addresses a known possible bottle neck effect
that could occur when not making the "select" part of the query, it will work but uses more ressources.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top