Current location: Hot Scripts Forums » Programming Languages » PHP » mkdir() with wrong folder name value


mkdir() with wrong folder name value

Reply
  #1 (permalink)  
Old 06-02-08, 12:32 PM
liees liees is offline
New Member
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
mkdir() with wrong folder name value

Hi...

i'm a newbie in programming. can someone help to assist ....

i'm trying to create new sub folder inside the upload folder. however the folder name value is not as expected.

the code is below

PHP Code:

<?php

require_once('db.php');
include(
'functions.php');
include(
'settings.php');

//folder name value equal username value
$fname "get_username($_SESSION[user_id])";
mkdir ("/home/eddy/public_html/testing2/upload/$fname/"0777);
?>
the folder name created should be the same name as "username" but the current cretaed output folder name called "get_username()" instead of "username"

where do I get wrong?? please help...

Last edited by mab; 06-02-08 at 12:56 PM. Reason: Code in code tags please.
Reply With Quote
  #2 (permalink)  
Old 06-02-08, 03:05 PM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
Change this line:
PHP Code:

$fname "get_username($_SESSION[user_id])"
To:
PHP Code:

$fname get_username($_SESSION['user_id']); 

You were trying to call get_username() function, but you put quotes around it which will make the value "get_username()"

Lex
__________________
01010000 01001000 01010000
Reply With Quote
  #3 (permalink)  
Old 06-02-08, 10:26 PM
liees liees is offline
New Member
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks phpdoctor for your advice!

but still no luck.. i tried to called the get_username() function and it give me an error...

below is the error message after i changed the code to
$fname = get_username($_SESSION['user_id']);

Error
Warning: mkdir() [function.mkdir]: File exists in /home/eddy/public_html/testing2/confirm.php on line 7

Btw, the folder is not created and not such folder name exists

is the anything else i do wrong on the code?

Liees

Last edited by liees; 06-02-08 at 10:30 PM.
Reply With Quote
  #4 (permalink)  
Old 06-03-08, 12:58 AM
phpdoctor's Avatar
phpdoctor phpdoctor is offline
Code Guru
 
Join Date: Feb 2007
Location: New Zealand
Posts: 767
Thanks: 4
Thanked 2 Times in 2 Posts
try this:
PHP Code:

 mkdir ("./upload/$fname"0777); 

or i think this:
PHP Code:

 mkdir ("upload/$fname"0777); 

Lex
__________________
01010000 01001000 01010000
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a folder from the web ryaneveritt Script Requests 2 01-29-08 06:38 PM
creating a folder and uploading image to that macintosh PHP 14 05-11-07 08:54 AM
how can Delete folder with all files and folder ram PHP 1 10-11-06 11:39 PM
showing all pages on a folder on index file. itssami PHP 17 08-13-06 03:21 AM
edit php in Squirrelmail jrcortrightiii PHP 1 07-10-03 02:08 PM


All times are GMT -5. The time now is 07:44 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.