Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Some Mysql Basics
Blessed
post 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
Go to the top of the page
 
+Quote Post
vipervoid
post 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.. biggrin.gif, that could be helpful for some newbies.
Go to the top of the page
 
+Quote Post
Stenno
post 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
Go to the top of the page
 
+Quote Post
rigueira
post 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
Go to the top of the page
 
+Quote Post
galexcd
post 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



QUOTE(rigueira @ Nov 25 2007, 01:47 PM) *
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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Problem On Mysql "order By"(5)
  2. Increment A Mysql Column(7)
  3. Can You Add Images Into A Mysql Database?(20)
  4. Subquery In Mysql(5)
  5. Creating Profiles In Php/mysql ?(7)
  6. Php Search Engine Script For Mysql Database(11)
  7. How To Delete A Row In Mysql.(4)
  8. Editing Information In A Mysql Database And Deleting Rows(5)
  9. Putting Data Of 2 Pages In Mysql At Once(1)
  10. Mysql Query(2)
  11. Simple Mysql Query Limiting(9)
  12. Php, Mysql, Apache(4)
  13. Php And Mysql Applications(3)
  14. Getting Php 5 To Work With Mysql(0)
  15. Problem With A Mysql Join(2)
  1. The Artists Tutorials :mysql Basic Commands(0)
  2. [mysql]get Id Of Loged In User?(7)
  3. [mysql/php]need Som Basic Help(13)
  4. [php/mysql]id Trouble [resolved](3)
  5. Mysql Won't Update(4)
  6. Php + Mysql Question!(4)
  7. Tools Needed!(9)
  8. Best Sites For Learning Php-mysql(4)
  9. Php And Mysql Programming(2)
  10. Best Php And Mysql Editor For Noobs(6)
  11. Html Form!(4)
  12. Mysql Error(3)
  13. Create Table - Mysql Code - Help(1)


 



- Lo-Fi Version Time is now: 8th September 2008 - 01:31 AM