localhost Posted June 28, 2006 Share Posted June 28, 2006 [code]$query = "INSERT INTO users (`username`, `email`, `password`, `joindate`, `ipaddress`, `auth`, `dir`) VALUES ('$username', '$email', '$enc_password', '$joindate', '$ipaddress', '$auth', '$num')";$result = mysql_query($query) or die('Could not insert user details into database.');}}if($result) {$queryS = "SELECT * FROM users";$resultS = mysql_query($queryS) or die(mysql_error());$fetch = mysql_fetch_array($resultS) or die(mysql_error());$userdir = $fetch['dir'];/* NOTE, BACKSLASHES MUST BE USED WITH WINDOWS, IF ON LINUX OR UNIX SERVER REPLACE \ WITH /'S IN THE NEXT LINE */mkdir("files\$userdir\$username", 0777);}[/code]i made it so a random code is generated numbers only, is then inserted into the database under that users row, i am trying to make it so upon registration it takes that 6 digit code and makes the folder under files\.it is not working, although the 6 digit random number does get generated and inserted into the db. Link to comment https://forums.phpfreaks.com/topic/13143-mkdir-not-working/ Share on other sites More sharing options...
wildteen88 Posted June 28, 2006 Share Posted June 28, 2006 With windows use two \\ like so:[i]mkdir("files\\$userdir\\$username", 0777);[/i]Currently PHP is escaping the $ sign on your variables so it creating folder called 'files$userdir$username' it is not parsing the variables. Now with the double backslahes PHP will not escape the $ sign.Also chnaging the CHMOD settings to 0777 is completly usedless on Windows as it doesnt use CHMOD. Link to comment https://forums.phpfreaks.com/topic/13143-mkdir-not-working/#findComment-50550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.