Forum Moderators: coopster
I have tried using another query, but only the subdirectory gets created then. Any ideas?
Thanks
Neil
SELECT link FROM categories
INNER JOIN subcategories
ON categories.id = subcategories.parentcatid
WHERE subcategories.id = '$cat_id22222'
------------------
$delete = $_GET['delete'];
$subcategory = $_GET['subcategory'];
$edit_id = $_GET['edit_id'];
$edit = $_GET['edit'];
$new_name1 = $_GET['new_name'];
$new_name2= strtolower(trim(ereg_replace(" ","",$_GET['new_name'])));
$subcategory2= strtolower(trim(ereg_replace(" ","",$_GET['subcategory'])));
//Create New Subcategory
if(!empty($subcategory) AND ($parent_id) == '0'){
echo "<p class='mainHeader'>You must specify a category from the dropdown.</p>";
}
if(!empty($subcategory) AND ($parent_id)!= '0'){
{
$cat_id22222 = mysql_insert_id();
$sql = "SELECT link FROM categories
INNER JOIN subcategories
ON categories.id = subcategories.parentcatid = '$cat_id22222'
ORDER BY link";
$result = mysql_query($sql,$cn);
while($rows=mysql_fetch_assoc($result)) {
$dir1 = "./../../" . $rows['link'];
$old_umask = umask(0);
@mkdir($dir1, 01777);
$dir2 = "./../../" . $rows['link']. "/" . $subcategory2;
$old_umask = umask(0);
@mkdir($dir2, 01777);
}
echo ($rows['link']);
$file = $dir2 . "/" . "index.php";
$fp = fopen ("$file", "wb");
$content = '<? $subcategory="' . $subcategory . '"; include ("../subcategory.php")?>';
fwrite($fp, $content);
fclose($fp);
$sql = "INSERT INTO subcategories (subcategory, sublink, parentcatid) VALUES('".$subcategory."', '".$subcategory2."', '".$parent_id."')";
$result = mysql_query($sql,$cn);
$sql = "INSERT INTO category_def (catid, subcatid) VALUES('".$parent_id."', '".mysql_insert_id()."')";
$result = mysql_query($sql,$cn);
}
}
[edited by: jatar_k at 3:11 pm (utc) on Sep. 13, 2005]
[edit reason] removed code dump [/edit]
Rather than show us your code, can you explain what your table looks like and what you are attempting to do, maybe with some example data?
Also, are you getting any error messages? I find that dumping the variable to the browser right before making the directory often helps in troubleshooting issues such as these too.