Blessed 0 Report post Posted April 26, 2007 Greetingsthis tutorial will show you some mysql basics..MySQL is one of the most used database.a simple config fileat the top add this <?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 databasemysql_connect($host,$username,$password);mysql_select_db($db); Some basic statementsNow we're going to see the following statements:- CREATE- SELECT- INSERT- UPDATE- DROP- ALTER- DELETECREATE:CREATE. You do that like this:CREATE TABLE tablename(fieldname datatype,fieldname datatype,); +-----------------------------------------------------These are the different datatypes you can choose from:Datatype / ExplanationTINYINT Integer from -128 tot 127SMALLINT Integer from -32.768 tot 32.767MEDIUMINT Integer from -8.388.608 tot 8.388.607INT Integer from -2.147.483.648 tot 2.147.483.647BIGINT Integer from -9.223.372.036.854.775.808 till 9.223.372.036.854.775.807FLOAT number with a ','DOUBLE number with a ',' but with is more specifierDATE UNIX-dateDATETIME UNIX-date and timeCHAR String with a number of charactersVARCHAR String with a number of charactersTINYBLOB Little BLOB-fieldTINYTEXT Little TEXT-fieldTEXT Textfield without restrictions, comes in handy for big documentsBLOB (Binairy Large OBject) The same as TEXT but only with BINARY DATALONGBLOB Huge BLOB fieldLONGTEXT Huge TEXT fieldENUM No explanationSET No explanation+-----------------------------------------------------I will update the post later to add more basic things Share this post Link to post Share on other sites
vipervoid 0 Report post Posted September 25, 2007 thats nice.. , that could be helpful for some newbies. Share this post Link to post Share on other sites
Stenno 0 Report post Posted October 2, 2007 (edited) 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! Edited October 2, 2007 by Stenno (see edit history) Share this post Link to post Share on other sites
rigueira 0 Report post Posted November 25, 2007 can I use DROP to delete a table?like:DROP TABLE table_name Share this post Link to post Share on other sites
galexcd 0 Report post Posted November 26, 2007 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. Share this post Link to post Share on other sites