Re: temporary files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You might consider using tmpnam() instead. tmpnam() doesn't give you a file handle (like tmpfile() does), but rather a file name. Just pass it a directory (like "/tmp") and a prefix to help identify it (can be "" ). It returns the unique file's name, and you could open a file handle to it with fopen(). Keep in mind that you have to unlink() it when you're done.

Hope this helps!

--Dave

Lars Tvedt wrote:

Im trying to create a way of storing php scripts in a mySQL database and
then execute them using temporary files as executable script buffers..

Ive got a mysql table with 4 fields: execID, execName, execDesc and execProc
The last one contains php code.

This is what i have so far:


<?php mysql_connect($host,$user,$pw); mysql_select_db($db); $query = "SELECT execProc FROM exec WHERE execID = 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $proc = $row['execProc']; } $handle = tmpfile(); fwrite($handle, $proc); include("name of the temporary file"); fclose($handle); ?>



But i need to get the name of the tempfile in order to include it..
all i have now is the handle_id
any help appreciated.











--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux