I was searching and found a similar topic from a year, but didnt want to bump it.
For some reason my code is getting hung up, it isnt presenting any errors, but it isnt completeing the task either. Thanks for the help in advance.
What is suppose to be happening is i have a update page where people can update x amount of rows at one time, working great to send the information to the database. only thing these files are available in other places on the site, and so they are available dynamically. which means the physical directory/ document needs to be moved or altered to match the database.PHP Code:function documentName_change()
{
//The table we are choosing to connect to
$tbl_name = "pr_mngmnt_manual";
// find out how many records there are to update
$documentName_size = count($_POST['document']);
// start a loop in order to update each record
$i = 0;
while ($i < $documentName_size) {
$query = mysql_query("SELECT DISTINCT id, document, filetype, title FROM $tbl_name");
$num = mysql_numrows($query);
$id = 0;
while ($id < $num) {
// names of the columns that hold the information prior to an update to that particular row.
$id = mysql_result($query,$id,"id");
$document = mysql_result($query,$id,"document");
$directory = mysql_result($query,$id,"filetype");
$subfolder = mysql_result($query,$id,"title");
$newDocumentName = "sys:apache2\htdocs\usa\docs/$directory/$subfolder/$document";
++$id;
$documentName= $_POST['document'][$i];
$id = $_POST['id'][$i];
//changing the name
if (file_exists($documentName))
{
rename ($document , $documentName) or die ("Could not rename file");
mkdir ($newDocumentName);
}
}
++$i;
}
}



Reply With Quote
Bookmarks