PDA

View Full Version : auto create new DB table from form data. how to?


deafboyzaudio
08-25-2009, 09:07 PM
When my users sign up, i want their username to be a new table in my database, that way i can keep all their uploads and such organized by username. I want it to be done automatically of course, anyone know how? thanks

domedia
08-26-2009, 06:23 PM
This should be a pretty basic insert statement.
Did you look at some beginner php tutorials?

Corrosive
08-26-2009, 06:49 PM
mysql_query("INSERT INTO users (username) VALUES ($username)");

Should cover it.

edbr
08-27-2009, 01:45 AM
just to be clear as corrosive suggested this will create a new record into table , which would be the normal way to do this.
the record can then be updated when new info is added .another way is to make a new table for the later info and join the tables

deafboyzaudio
08-28-2009, 04:43 PM
Yes DM, i did look at a bunch of tutorials. They all say how to insert a record into a table and update it, delete it and such. im really trying to make a whole new table, not just a new record in a table. i want it to be done automatically when they sign up, then i will insert records into their whole new table.

domedia
08-28-2009, 05:30 PM
Yes DM, i did look at a bunch of tutorials. They all say how to insert a record into a table and update it, delete it and such. im really trying to make a whole new table, not just a new record in a table. i want it to be done automatically when they sign up, then i will insert records into their whole new table.

That is a horrible design. Put them in a users table and just do it the normal way. Did you read anything about how/which tables to set up for applications?

deafboyzaudio
08-31-2009, 05:57 PM
thanks for the input, I belong to lynda.com and i havent seen anything about applications and which tables to use. just a whole lot about how to insert, rename, etc. not much on the organization of them.

As it is now, i have a user table for username, password. all the uploads are being stored in my uploads folder(not in a DB) I was thinking about implementing a naming procedure to "tag" the file with their username, type of car, and brand...

Is it possible to "tag" a file so that it can be indexed for multiple search terms? just tryin to devise a effecient search and organizing method. thanks