Jump to content
xisto Community
BooZker

Confused In Phpmyadmin Dont know what to do anymore

Recommended Posts

I have a book, PHP and MySQL for Dummies, and i guess i am more then a dummy. It is my first time setting up my own database from scratch. In the book it says to set up the table, but it doesnt tell you what to use or anything. Just to set one up and explains what you put and where. Here is where i am:I made a Database called "boozker_aah" (not going to say what aah stands for yet. Its for my new site)Then i want to make a table for the users (right?) I called it "aah_users"Here is where i get confused. I want to make a user system and each user should have this data connected to it:id #(required right?)first_name (I want it to be required)last_name (I want it to be required)email (I want it to be required)Age (Not required)Country (Not required)Website (Not required)Short Bio (Not required)Am i supposed to just put that data in the table aah_users? If so what do i put in the other fields? I am SO confused on this.Also it says if i want to know when and how often users sign in and out to make a table which, in my case, would be called aah_logins. What do i put in those fields?Lastly, what about the MAIN part of the whole user system? The user name and password? What do i do with that? I want a form for them to fill out and it makes it automatically like most sites. Fill in the above data along with a user name and password and it makes you a user. I don't need the PHP for this yet. I just need to know what to do with the MySQL stuff in PHPMyAdmin for the above stuff. It covers what i need to do in the PHP, but i dont know what to do with the MYSQL I am really confused. Thanks so much if anyone actually helps.

Share this post


Link to post
Share on other sites

Are you doing this on your own machine? or here at the Trap? Aside from version differences of the softwares, there is a MAJOR difference in the procedures. The Shared Hosting at the trap will not allow you to create a Database using phpadmin. You need to use the MySQL Admin in the Control Panel to create a Database on the trap and then use phpadmin to add tables, etc. And don't forget to add a User and GRANT privleges to the User.However, you will be able to create a database on your own local machine using phpadmin and that is pretty simple to do. Once you have the database created, select the database from the drop-down on the left hand side. This will now become the current database and it should report that there are no tables, then the right side will ask about adding a table. Enter the table-name, number of fields and then "go". Phpadmin will then display a grid of input filelds to add the values for the various elements of the "rows". The book you are using should provide enough information to allow you to complete the entries, such as the field's 'name', 'type', 'length', null/not null, and index, etc. when you are finished, select 'save' and it should all be good.There is a selection to "EXPORT" . This will produce a file containing all the code to create the same db and table via the SQL method, but that is another lesson. Hope this helps you understand it a bit better.

Share this post


Link to post
Share on other sites

I am doing this on Trap.In my books example it says it needs a Member Directory Database, named MemberDirectory, then a table named member. I did that. So now in those rows i put the information i talked about above (name, age, ect) in those fields? Also how do i make a unique member ID number? There are a lot of fields. What things to i put and turn on?

Edited by BooZker (see edit history)

Share this post


Link to post
Share on other sites

Those fields will contain the information required to set up the database only. They do not contain the data, just the information which describes the data, and instructs the sql server how to store it, and what to expect for values, etc.The first column will contain the name of the field, and then the type of data expected, and so on across the page. The field which is given the value "UNIQUE" must be ... well, unique... for the database and values can be automatically included when data is INSERT'ed. Read some more of the book and you will catch on to what sort of information is expected.

Share this post


Link to post
Share on other sites

Thats the problem... they go into the PHP side of it next. I need to set up the database before i can move on and i am totally stuck on it. They are saying to put rows and columns when i can't and everything is simply rows in PHPMySQL. Is there anyway you could put those fields in and take a screen shot as an example using the fields i want such as the ID # and first_name last_name and age ect?

Share this post


Link to post
Share on other sites

Here ya go.

In phpadmin, select the database, then select the SQL tab and cut/paste the following CREATE command into the textarea:

CREATE TABLE `users` (`id` SMALLINT( 8 ) UNSIGNED NOT NULL AUTO_INCREMENT ,`first_name` VARCHAR( 16 ) NOT NULL ,`last_name` VARCHAR( 16 ) NOT NULL ,`email` VARCHAR( 32 ) NOT NULL ,`age` SMALLINT( 2 ) NULL ,`country` VARCHAR( 16 ) NULL ,`web_site` VARCHAR( 32 ) NULL ,`short_bio` LONGTEXT NULL ,UNIQUE (`id`)) ENGINE = MYISAM;
It should create a table as per your information.
The schema is fairly minimal. I would've used Date of Birth instead of age, for instance, but perhaps the book will take you on towards Data Base Optimisation and Codd's rules.

Also, this should be saved as a file type " .sql ". The same or similar format can be created via phpadmin by 'EXPORT'ing the DB schema. And then 'IMPORT' the command to re-create a data structure. Handy to keep the current db in this format in case something explodes on you.

Try it. :lol:

Share this post


Link to post
Share on other sites

Boozker, do you have any popular PHP script installed on your Xisto account (e.g. WordPress, SMF, etc), anything that uses MySQL to store data? If so, learn from those. Look at how those databases are set up in PHPMyAdmin. If you have your own server on your computer installed with MySQL, get the MySQL Tools from the MySQL site (i'd recommend using the Query Browser). Learn from all of these things. Also, doesn't PHPMyAdmin show you the queries that were used when navigating through it? You remind me of myself when i first took a look into all of this. :lol: So much too learn, and so much time to do it in! :lol:

Share this post


Link to post
Share on other sites

I got about 80% of that right :lol: I messed up on the Collation and a couple of the types and 2 actions. Thanks so much. That taught me a lot. Now i can finally move on from page 52 :lol: I read 52 pages in one day and finally got stuck on that stupid page. Thanks. I know there is so much to learn. When i signed up at trap almost a year ago (April) i barley knew HTML. Now i know all the XHTML rules, CSS 1-2, and learning XML all within a year. So I have been learning a lot. It just takes me sometime considering i didnt even know what PHP was 8 months ago. Then Paul on the forums showed me some PHP Includes! God how i love those!

Share this post


Link to post
Share on other sites

By the way, I guessed at most of those settings. :lol:

Use phpadmin to modify them as you need to. Chances are, if the book is any good, they will require you to add/change the TABLE structures to adapt the scripts, etc as a learning tool. Mysql is quite adapable.

Good luck with it.

Here is a link you might learn good stuff from (although it might confuse you,too) :

Database Optimisation

Share this post


Link to post
Share on other sites
CREATE TABLE `aah_members` (`loginName` VARCHAR( 20 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT 'login name',`password` VARCHAR( 16 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT 'user password',`createDate` DATE NOT NULL COMMENT 'user sign up date',`lastName` VARCHAR( 50 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,`firstName` VARCHAR( 40 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,`email` VARCHAR( 50 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,`country` VARCHAR( 50 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,`age` CHAR( 2 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,PRIMARY KEY ( `loginName` )) ENGINE = MYISAM;

Does this look right? I made another one from scratch as practice, but added login name sign up date and a password. Would those be right? I want all those to be required also.

I'll check out that link also.

Share this post


Link to post
Share on other sites

COLLATE latin1_swedish_ci

What's this all about? I'd drop that unless your building a Swedish language site. That'll mess up the Database contents.

Share this post


Link to post
Share on other sites

OK i will fix it. Should i just make that blank? Thats what the defaults were on my others such as phpBB.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.