[SOLVED] whats is the set of orders to build a database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

[SOLVED] whats is the set of orders to build a database

Post by pelegk2 »

and then a table with its columns
using php and mysql database?
thnaks inadvance
peleg
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Start with the MySQL manual - http://www.mysql.com/doc - it has all the SQL commands you will need.

Mac
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Also read into http://www.php.net/mysql :)
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

definitely look through the manual and a tutorial or 3..
here is a sample once you are ready to tackle it:

Code: Select all

<?php

$link=MYSQL_CONNECT($host,$username,$password) OR DIE("Unable to connect to database")

$query = "CREATE TABLE Browser (
  id int(11) NOT NULL auto_increment,
  data text NOT NULL,
  platform varchar(25) NOT NULL default '',
  type varchar(25) NOT NULL default '',
  version varchar(25) NOT NULL default '',
  PRIMARY KEY  (id)
)";

$result=mysql_query($query,$link) or die(mysql_error()."$query");

?>
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

you'll need to create the DB first by running
a query command line or with php..

CREATE DATABASE dbname

sorry forgot that step... :?
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

thanks alot every one
Post Reply