Hello I have created a script that allows an admin to create folders, but I need to be able to add a sub folder within each folder depending on which company id is selected, everything works apart from the creation of the sub-folder any help would be appreciated, as I still very new to PHP.
Thank you in advance for all your help.
$name is the main folder name which the admin makes by filling in a basic form.
$companyid is my sub folder variable which doesn't work, I've even changed it to $companyid = "hello"; to see if that would create a subfilder called 100 but it didn't.
$sql="SELECT * FROM folders WHERE name='".$name."' AND parentID='".$parentID."'" ;
$result=mysql_query($sql) or die("oopsy, error selecting folder from database for comparison");
if(mysql_num_rows($result)>0){
$msg = "Folder already exists in database. Try another one.";
} else {
if(!empty($name)){
if(!empty($parentID) && $parentID!=0){
$qq="SELECT name, company_id FROM folders WHERE parentID='".$parentID."'";
$ress=mysql_query($qq);
$rrr=mysql_fetch_assoc($ress);
$mainFolderName = $rrr["name"];
$companyid = $rrr["company_id"];
//also create mkdir folder in script base, and make it writable
$thisdir = getcwd();
@mkdir($thisdir."/".'uploads'."/".$name."/".$companyid , 0777);
//chmod($script_dir.$name, 777);
} else {
//also create mkdir folder in script base, and make it writable
$thisdir = getcwd();
@mkdir($thisdir."/".'uploads'."/".$name."/".$companyid , 0777);
//chmod($script_dir.$name, 777);
}
strong text