I upgraded mysql 3.23 to 4.0.18 by following methods:

1.First stop the running MySQL Server (for example, with NET STOP MySQL.
2. And Run the installation script of the Windows distribution by clicking the Install button.
3.overwrite my old MySQL installation located at `C:\mysql').
4.Restart the server. Using NET START MySQL .
5.and finally updated the grant tables.

After completion this process First time I created temporary table successfully through my php script.
But second time when I run my php script again for creation of temporary table after restart the system. Then creation of temporary table doesn’t occur.