note 50845 deleted from function.rename by nlopess
| From: | nlopess@php.net | Date: | Fri, 11 Mar 2005 19:49:49 +0000 |
| Subject: | note 50845 deleted from function.rename by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86293@lists.php.net to get a copy of this message | ||
Note Submitter: Felipe Meyer
Reason: useless
----
This script can work too renaming the directory. For example, if you want to rename a directory
using numbers and not names you can do like this:
$dir = "./files/";
$query = "SELECT id FROM table WHERE field=\"$field\";\n";
$res = mysql_query($query);
list($id) = mysql_fetch_row($res);
if ($id != "") {
rename("$dir/$field", "$dir/$id");
}