I'm attempting to focus on a login and registration page and i'm creating a new database and that i can perform it fine such as this:
mysql_select_db("my_db", $con); $sql = "CREATE TABLE Persons ( FirstName varchar(15), LastName varchar(15), Age int )"; // Execute query mysql_query($sql,$con);
and things i am attempting to do is replace the "persons" having a string to ensure that it can make a table but it's dynamic. I want a string because I'm creating a table for every user that registers and also the new table's title is the account information send with an md5sum file encryption. I have attempted this without results it will not create a new table such as the other you do :
mysql_select_db("my_db", $con); $sql = "CREATE TABLE $data ( FirstName varchar(15), LastName varchar(15), Age int )"; // Execute query mysql_query($sql,$con);
help me, i type of need this fast. I have attempted joining strings along with no luck and so i need assistance
I am trying to produce a database table for every user who registers. What shall we be held doing wrong?
You're developing a database table for every user who registers.
This isn't the way in which you are designed to use relational databases. You produce a row for every new user, not really a table. Obviously you will need a couple of extra posts inside your
Persons table, such as the
Password. I'd also recommend against storing age because that isn't constant. Keep
INSERT INTO Persons (FirstName, LastName, Birthday, Password) VALUES ('John', 'Smith', '1980-07-21', 'SOME HASH HERE');
I think you'll do not take it wrong, but you have to decelerate a little and find out more about SQL prior to trying to create more code. Believe me, it will be better over time.
I really just split the code into seperate strings and merely became a member of them together. Even the data for the reason that is simply a good example i am not really putting age in i really have about 40 fields that i'm putting in to the table.