Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
halp me
04-02-2014, 08:20 AM,
Post: #1
halp me
plz tell me how 2 Create Database forr acctive my php form site...plz halp any one
06-25-2014, 07:44 AM, (This post was last modified: 06-25-2014, 07:44 AM by pagu952y.)
Post: #2
RE: halp me
Pm me ur problem in detail
06-25-2014, 09:06 AM, (This post was last modified: 06-25-2014, 09:15 AM by Tunzwap.)
Post: #3
RE: halp me
ok how to create a db plz how wil teach you from scratch

Step 1: Create the database
The first thing we need to do is create a MySQL
database to store our content. You can do this as
1. Run the mysql client program
Open a terminal window and enter the
mysql -u username -p
Then enter your MySQL password when
username should be a user that has permission
to create databases. If you're working on a
development server, such as your own
computer, then you can use the
root user for
this, to save having to create a new user.
2. Create the database
At the mysql> prompt, type:
create database cms;
Then press Enter.
3. Quit the mysql client program
At the mysql> prompt, type:
Then press Enter.
That's it! You've now created a new, empty database,
into which you can put your database tables and
Some web server setups let you create databases via
a web-based tool such as cPanel or Plesk (in fact
sometimes this is the only way to create MySQL
databases). If you're not sure what to do on your
server, ask your tech support team for help.
Step 2: Create the articles database table
Our simple CMS has just one database table: articles.
This, as you'd imagine, holds all of the articles in the
Let's create the schema for the table. A table's
schema describes the types of data that the table
can hold, as well as other information about the
Create a text file called tables.sql somewhere on your
hard drive. Add the following code to the file:
id smallint unsigned NOT NULL auto_
publicationDate date NOT
NULL, # When the article was
title varchar(255) NOT NULL,
# Full title of the article
summary text NOT
NULL, # A short summary of
the article
content mediumtext NOT
NULL, # The HTML content of the
The above code defines the schema for the articles
table. It's written in SQL, the language used to create
and manipulate databases in MySQL (and most other
database systems).
Let's break the above code down a little:
1. Create the articles table
DROP TABLE IF EXISTS articles removes any
existing articles table (and data — be careful!) if
it already exists. We do this because we can't
define a table with the same name as an
existing table.
CREATE TABLE articles ( ) creates the new
articles table. The stuff inside the parentheses
defines the structure of the data within the
table, explained below...
2. Give each article a unique ID
We're now ready to define our table structure.
A table consists of a number of
fields (also
called columns). Each field holds a specific type
of information about each article.
First, we create an
id field. This has a smallint
unsigned (unsigned small integer) data type,
which means it can hold whole numbers from 0
to 65,535. This lets our CMS hold up to 65,535
articles. We also specify the
NOT NULL attribute,
which means the field can't be empty (null) —
this makes life easier for us. We also add the
auto_increment attribute, which tells MySQL to
assign a new, unique value to an article's id
field when the article record is created. So the
first article will have an
id of 1, the second will
have an id of 2, and so on. We'll use this unique
value as a handle to refer to the article that we
want to display or edit in the CMS.
3. Add the publicationDate field
The next line creates the publicationDate field,
which stores the date that each article was
published. This field has a data type of
which means it can store date values.
4. Add the title field
Next we create the title field to hold each
article's title. It has a data type of varchar(255),
which means it can store a string of up to 255
5. Add the summary and content fields
The last 2 fields, summary and content, hold a
short summary of the article and the article's
HTML content respectively. summary has a
data type (which can hold up to 65,535
characters) and
content has a mediumtext data
type (which can hold up to 16,777,215
6. Add the primary key
The last line inside the CREATE TABLE statement
defines a key for the table. A key is also called
an index, and in simple terms it makes it
quicker to find data in the table, at the expense
of some extra storage space.
We make the
id field a PRIMARY KEY. Each
table can only have a single PRIMARY KEY; this
is the key that uniquely identifies each record in
the table. In addition, by adding this key, MySQL
can retrieve an article based on its ID very
Now that we've created our table schema, we need
to load it into MySQL to create the table itself. The
easiest way to do this is to open up a terminal
window and change to the folder containing your
tables.sql file, then run this command:
mysql -u username -p cms < tables.sql
...where username is your MySQL username. cms is
the name of the database that you created in Step 1.
Enter your password when prompted. MySQL then
loads and runs the code in your
tables.sql file,
creating the articles table inside the cms database.
You can also use a web-based admin tool such as
phpMyAdmin to run your tables.sql code and create
the table. phpMyAdmin comes pre-installed with most web hosting accounts.

Forum Jump:

Users browsing this thread: 1 Guest(s)