grandman Posted December 4, 2008 Share Posted December 4, 2008 Hello, I desperately need help now, as I no longer know what "mkdir()" is doing. I had problems with getting it to go to the correct directory, we'll that's resolved. Now it's going to the directory and then just displaying the index file in that directory, it's not making the sub directory I want. The problem I thought was with my using the variable $username as the new directory name, then I realised I needed to add a simple db query to retrieve the username. The script looks like this (is still WIP) <?php ob_start(); $conn = mysql_connect("host", "user name", "password") or die(mysql_error()); mysql_select_db('dbname', $conn) or die(mysql_error()); $fields = mysql_query("SELECT * FROM db",$Database); $vars = mysql_result($fields,"vars"); $vars = $_POST["username"]; $filename = "on/cont/{$Username}"; if (file_exists($filename)) { header ( "Location: " . "$filename" . $_POST["username"]); } else { mkdir("on/cont/ . {$Username}", 0777); echo "welcome " . $_POST["username"] . "Your Area Is Being created."; } ob_end_flush(); ?> and all I get is the index file in the end folder, it does nothing ??? I am finally going mad, it will not make a directory, please, please help me someone... For heck sake it's found the directory, it must now have the correct user name, what more does it want "blood"??? DG Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted December 4, 2008 Share Posted December 4, 2008 $username is still undefined. Where are you trying to get it from? The database? Oh, and the second parameter for mysql_result should be integer corresponding to the row in the result set you wish to use. Quote Link to comment Share on other sites More sharing options...
grandman Posted December 4, 2008 Author Share Posted December 4, 2008 $username is still undefined. Where are you trying to get it from? The database? Oh, and the second parameter for mysql_result should be integer corresponding to the row in the result set you wish to use. Hello, Just learning php and MySql, is it possible for you to point me in the right direction please, BTW I want to get the row that contains the new username, can that be done..... DG Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.