|
|
|
|
![]() ![]() |
Apr 26 2007, 09:46 PM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 144 Joined: 22-March 07 Member No.: 40,472 |
Greetings
this tutorial will show you some mysql basics.. MySQL is one of the most used database. a simple config file at the top add this CODE <?php ?> after <?php add $username= "root"; // Username that has access to your database $password= ""; //Password that has access to your database $host = "localhost"; // The host where the database is (mostly this is localhost) $db = "databasename"; // The name of the database where you want to work with //connect to the database mysql_connect($host,$username,$password); mysql_select_db($db); Some basic statements Now we're going to see the following statements: - CREATE - SELECT - INSERT - UPDATE - DROP - ALTER - DELETE CREATE: CREATE. You do that like this: CODE CREATE TABLE tablename( fieldname datatype, fieldname datatype, ); +----------------------------------------------------- These are the different datatypes you can choose from: Datatype / Explanation QUOTE TINYINT Integer from -128 tot 127 SMALLINT Integer from -32.768 tot 32.767 MEDIUMINT Integer from -8.388.608 tot 8.388.607 INT Integer from -2.147.483.648 tot 2.147.483.647 BIGINT Integer from -9.223.372.036.854.775.808 till 9.223.372.036.854.775.807 FLOAT number with a ',' DOUBLE number with a ',' but with is more specifier DATE UNIX-date DATETIME UNIX-date and time CHAR String with a number of characters VARCHAR String with a number of characters TINYBLOB Little BLOB-field TINYTEXT Little TEXT-field TEXT Textfield without restrictions, comes in handy for big documents BLOB (Binairy Large OBject) The same as TEXT but only with BINARY DATA LONGBLOB Huge BLOB field LONGTEXT Huge TEXT field ENUM No explanation SET No explanation +----------------------------------------------------- I will update the post later to add more basic things |
|
|
|
Sep 25 2007, 01:46 PM
Post
#2
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 15 Joined: 3-September 07 Member No.: 49,306 |
thats nice..
|
|
|
|
Oct 2 2007, 05:25 AM
Post
#3
|
|
|
Newbie [Level 1] ![]() Group: [HOSTED] Posts: 21 Joined: 29-September 07 Member No.: 50,836 |
QUOTE Some basic statements Now we're going to see the following statements: - CREATE - SELECT - INSERT - UPDATE - DROP - ALTER - DELETE I think you forgot TURNICATE, to empty tables EDIT: after a double check, it turned out to be TRUNCATE instead of TURNICATE. Sorry guys, hope i editted it soon enough! This post has been edited by Stenno: Oct 2 2007, 06:25 PM |
|
|
|
Nov 25 2007, 09:47 PM
Post
#4
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 28 Joined: 25-November 07 Member No.: 53,723 |
can I use DROP to delete a table?
like: DROP TABLE table_name |
|
|
|
Nov 26 2007, 01:58 AM
Post
#5
|
|
|
Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,023 Joined: 25-September 05 From: L.A. Member No.: 12,251 |
can I use DROP to delete a table? like: DROP TABLE table_name Yup, drop can be used for deleting tables, and it can even be used for deleting an entire database if you want. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 8th September 2008 - 01:31 AM |