Frans Schmidt wrote:
I want to make a new database with several tables, so I did the following:
<?php
CREATE DATABASE bedrijf;
CREATE TABLE werknemers
(voornaam varchar(15),
achternaam varchar(20),
leeftijd tinyint(3),
adres varchar(30),
woonplaats varchar(20),
land varchar(20));
?>
What is wrong with this, and do you know another way to make a new database?
Is there a site that explains all about myadmin?
Thanking you in advance,
Ruben.
You can start by telling php what server the database is on. What kind
of database this is, and what username and password to use to loginto
the database. aka RTFM.
//create a link and loginto a mysql database
$dblink = mysql_connect(serveraddress, username, password);
//define our query to said server
$Query0 = "CREATE DATABASE bedrijf";
$Query1 = "CREATE TABLE werknemers"
"(voornaam varchar(15),".
"achternaam varchar(20)," .
"leeftijd tinyint(3)," .
"adres varchar(30)," .
"woonplaats varchar(20)," .
"land varchar(20))";
//make our query.
$dbresult = mysql_query($Query0, $dblink);
$dbresult = mysql_query($Query1, $dblink);
There is a _very_ small amount of things to read that will enable you to
do this properly, but you should do so.