mySQL and PHP - Login and Registration - Saving Movie Clip ('s) Position - Page 2
Let's Get Started - Part I - setting up the mySQL database and relevant SQL commands
You must have a mySQL server set up by your host or on your local machine. I'll be using the most basic shell commands to set up the table. However their are GUI's out there to make this part easier. Your host may already have one set up for you to use. Make sure to read all the documentation your host has available on using mySQL on their servers - some may be different. But it should all basically be the same.
Once your database has been set up. Open up your shell account. In most cases you can use Telnet to get to your account. From the telnet command prompt - type in mysql -p YourDatabaseName Then you will be prompted for a password. Type in your password. You'll see some text appear after this, then the command prompt changes to read mysql> (then Type) use Database Name. We will name the table saveMovie for this example. Then type in the following create table syntax exactly as it appears below:
You can then use the describe table command to see what the table looks like.
Here are a couple other mySQL commands you may find useful from the shell.
Change the Column Name: mysql>alter table saveMovie change Name SomeotherName varchar(30); (This just changes the name notice the syntax - after change enter the old Column Name followed directly after by the New column name and definition.
Delete one of the Columns: mysql>alter table saveMovie drop Name; This just deletes the column that you had previously named "Name".
Select and view everything in the Table: mysql>Select * from TableName;
Delete the whole table and start over: mysql>drop saveMovie;
Short List of Column types (not if the data that you have entered into one of these definitions is larger then the amount you specified in the table it will be cur off):
varchar (Number) - A variable text type - in my opinion the easiest and most flexible to use when first starting out. Maximum is 60 characters Long.
char (number) - A fixed character type column.
int (number) - A fixed integer type column. Default is 14 if you leave it blank.
text or blob - use either when you want to enter a large amount of text.
|» Level Advanced|
Rating: 8 Votes: 116
|No details available.|
|Download the files used in this tutorial.|
|Download (74 kb)|
|More help? Search our boards for quick answers!|