Jump to content

[SOLVED] problem with mkdir


grandman

Recommended Posts

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

Link to comment
Share on other sites

$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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.