Where are tempory tables or record sets located? Using mysql and php, I would like to understand where temporary results are stored. For instance, when I do a query that returns a set of data for processing by php, is the connection to the database closed and php storing the info for use or is that info kept in the database until php has finished using it?
It depends on mode used (buffered/unbuffered), as explained in the PHP manual:


  Queries are using the buffered mode by default. This means that query results are immediately transferred from the MySQL Server to PHP and is then kept in the memory of the PHP process. This allows additional operations like counting the number of rows, and moving (seeking) the current result pointer. It also allows issuing further queries on the same connection while working on the result set. The downside of the buffered mode is that larger result sets might require quite a lot memory. The memory will be kept occupied till all references to the result set are unset or the result set was explicitly freed, which will automatically happen during request end the latest. The terminology "store result" is also used for buffered mode, as the whole result set is stored at once.


Further reading


http://php.net/manual/en/mysqlinfo.concepts.buffering.php
http://dev.mysql.com/doc/apis-php/en/apis-php-mysqlinfo.concepts.buffering.html


This is answer to the "body" of your question. The title of that question asks about temporary tables, which are a different thing, internal to MySQL. If you are interested in that too, it is covered at https://dev.mysql.com/doc/refman/5.5/en/internal-temporary-tables.html

Simply said, MySQL stores small and simpler temporary results in memory and bigger ones and/or ones used in some more complex operations are stored on disk usually in temp folder.