I have a php page which displays quite a bit of dynamically calculated data which I need to be sortable using different SQL statements. Currently to display this data, a user browses to the page, the page checks for a cookie, if the cookie doesn't exist it includes some php to generate a temporary table with my data, activate the cookie, and then displays the data. My problem arises when I attempt to run another SQL statement on the temporary table. I do so by using a link such as 'page.php?sql=query_1' . The same page checks for the cookie now activated, indicating the temporary table has been created (at least that's how it works in my head), then tries to select data from the temporary table. What always happens at this point is I get an error saying that there is no table named "temporary_tbl". I understand that temporary tables are destroyed after the connection is closed, but when does a connection officially close? Would switching a php page, close the temporary table? Or could it be that I am calling a mySQL db link when I generate the temporary table, and then another one when I try to just sort the table without creating the temporary table? Any help is much appreciated, Nate