tags:

views:

48

answers:

2

I have ten fields in my table in database..And two columns out of them are of

  1. User_Id (auto_increment I need it for uploading pics.)
  2. Username (I want it as primary key so that no other user can get the same username)

I am not able to do both these things together. If I make user_id auto_increment then I am not able to assign primary key to Username. How I can overcome from this problem ?

2.

How to allow only doc (msword) files for uploading....

i tired ($_FILES["file"]["type"]=="application/msword") But this i snot working...I tried same code for pdf files that is working working code ($_FILES["file"]["type"]=="application/pdf")

3. First i upload files from an application form into a folder and stores its name and size into database.Then i deleted files from that folder and also deleted entry in database manuly...means now in my employee table there is no entry in database ..

But when i upload a file which has already been uploaded into database in past(to particular folder but i have deleted that file from folder and database) now if i apply file_exist condition it say that file already exists ..Why so..Is there is any tempory folder which is invisible from us..which contain this entry..???????

A: 

1: Let user_id be autoincremented and set username to UNIQUE

2: Are you sure this ("application/msword") is the right and only MIME-Type for word-documents?

3: Are you sure the file is getting deleted? You should double-check that. Sounds like file permission issues to me.

Karsten
1.If i make username unique then same username is being aloowed..2.Plz u tell what is right syntex3.Yaa i am able to delte it manuallyno problem ..just go in that folder and ctl+a and then dlte no problem
Deepak Narwal
1. no. a unique field is unique. if not, you are doing something wrong.2. we are not here to do your work for you.3. check if a script can delete those files, as it may run as another user with different permissions.
Karsten
A: 

Have you searched on your own?

For example this question addresses exactly your first questions: I need to auto_increment a field in MySQL that is not primary key

Felix Kling