472,954 Members | 1,682 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

how to make a new database?

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.
Jul 16 '05 #1
2 3287
uws
I <3f***********************@news.xs4all.nl>, Frans Schmidt skrev:
I want to make a new database with several tables, so I did the following:
<?php
CREATE DATABASE bedrijf;
?>
What is wrong with this, and do you know another way to make a new database?
You are writing SQL, not PHP. You will need to connect to a mysql server
first, and then execute the DDL queries.

Ruben.


Ruben or Frans? :s
mvrgr, Wouter

--
uws mail uw*@xs4all.nl

you're the mixed up girl that everybody leaves behind -- our lady peace
Jul 16 '05 #2
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.

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: WindAndWaves | last post by:
Hi Gurus I am keen to make a search page on a website, but I have absolutely zero experience with PHP. I am going to hire an expert, but I thought that it may pay to try it a bit first myself...
2
by: zahid | last post by:
Hello, Dear Friends, I have to make such type of interface,you can say it a html form. in which a admin can write arabic data and can insert that data or recordsin database in ASP. and i have to...
0
by: Federico Moschini [328594] | last post by:
I have to make difference between2 data from a table in SQL. The page is made with Frontpage, and it extracts QtaGiaCons and Quantita from table "oclrighe". I have to make Quantita -...
0
by: anuradha.k.r | last post by:
HI, I have created a database in MS access97.Also i have a program which would access the database and get me the required record and data.Later I upgraded to MS access 2000.Now I have two...
6
by: ronwer | last post by:
Hello, The title doesn't completely cover the question I have, but it's a bit more complicated problem we have. We are using a database, based on Acces, but developed by a third party...
4
by: Digital Fart | last post by:
howto make a connection to database available in my classes. What is the best practice when i want to write classes that need a connection to the database? Do i make a conn variable in my...
7
by: djc | last post by:
I have several subroutines (all inline code) that wind up using the same database connection object variable. I have been declaring a new variable in every sub. I just now came to a point where I...
3
by: LurfysMa | last post by:
I would like to hear opinions on the tradeoffs of putting the tables, forms, and queries for several related datasets in separate databases vs one combined database. I am working on an...
10
by: AA Arens | last post by:
I do have a database with customer info in it. To avoid it will be taken out of our office, is it possible to make it not-readable after a certain period? then every let say seven days, I needs to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.