When a customer logs in, I want to create all the folders under his id. I am doing it like this:
<?php
include('connect.php');
$aid = $_SESSION['application_id'];
$sql = "select * from ApplicationRegister where application_id= $aid" ;
echo $sql;
$result = mysql_query($sql) or die (mysql_error());
while ($row = mysql_fetch_assoc($result))
{
echo "<table width='65%' cellpadding='4' border='0'>";
echo "<tr><td> <h4> Company Name: </h4></td> <td>" . $row['CompanyName'] . "</td> </tr> ";
echo "<tr><td> <h4> Company E-mail: </h4></td> <td>" . $row['CompanyEmail'] . "</td> </tr>";
echo "<tr><td> <h4> Registration Type: </h4> </td> <td>". $row['RegistrationType'] . "</td></tr>";
echo "<tr><td> <h4> Plan: </h4> </td> <td>" . $row['ApplicationPlan'] . "</td></tr>";
echo "<tr><td> <h4> Registered Date: </h4> </td><td>" . $row['Createddate'] . "</td></tr>";
echo "</table>";
}
$file = $_SERVER['DOCUMENT_ROOT'];
echo $file;
mkdir("$file/opencart/images/$application_id/products/");
mkdir("$file/localhost/opencart/images/$application_id/category/");
mkdir("$file/localhost/opencart/$application_id/application/");
echo "directory created";
?>
I even checked the folder permissions. Its all read and write, but folders are not getting created. Please help me figure out how to do it.
Are you making sure the folders that you are putting folders in exist? Your first mkdir for example, make sure that opencart, images, $application_id exist and if not, do a mkdir on those before you mkdir inside those.