RE: [PHP] MySQL - Creating The Database

2002-06-04 Thread David Freeman


  Sorry if this is an ignorant question, but I want to do one 
  simple thing - create an empty MySQL-type database to upload 
  to the server so I can start using PHP to access it... how 
  can I do this? I don't really want to have to download the 
  whole MySQL product just to create an empty database!

Ummm, not sure exactly what you're asking but you can use mysql_query to
issue the relevant sql commands to create your database and tables and
so on.  In cases where I want to package something that kicks off I
usually create an install script that looks for the database I need and
if it doesn't exist then create it.

Obviously if you actually want to test code on your development box then
you're going to need an actual sql server to do it.

CYA, Dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jason Teagle


- Original Message -
From: David Freeman [EMAIL PROTECTED]
To: 'PHP Mailing List' [EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 11:50 AM
Subject: RE: [PHP] MySQL - Creating The Database


 Ummm, not sure exactly what you're asking but you can use mysql_query to
 issue the relevant sql commands to create your database and tables and

Am I correct in saying that none of the SQL functions in PHP can actually
create a database file when no file existed before? In other words, an empty
database file must exist before SQL functions can be called on it?

 so on.  In cases where I want to package something that kicks off I
 usually create an install script that looks for the database I need and
 if it doesn't exist then create it.

This is the problem - how _do_ you create it? What does your install script
do? Copy a blank template of a DB from a file in your installation package,
or literally create a new file? I have no existing databases to work with...
(what's the file extension for a MySQL-type database anyway [i.e., MS Access
= .MDB, MySQL = ?] ?)


 Obviously if you actually want to test code on your development box then
 you're going to need an actual sql server to do it.

That's no problem for me - I'm testing directly on the (remote) host anyway.
Better to test where it's going to be finally then get it all working
perfectly here and find it doesn't work there {:v)


_ _
o oJason Teagle
   [EMAIL PROTECTED]
 v



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jason Wong

On Tuesday 04 June 2002 19:03, Jason Teagle wrote:

  Ummm, not sure exactly what you're asking but you can use mysql_query to
  issue the relevant sql commands to create your database and tables and

 Am I correct in saying that none of the SQL functions in PHP can actually
 create a database file when no file existed before? In other words, an
 empty database file must exist before SQL functions can be called on it?

As the guy said, use mysql_query() to issue the sql commands to create the 
database:

 CREATE DATABASE my_database;

 This is the problem - how _do_ you create it? What does your install script
 do? Copy a blank template of a DB from a file in your installation package,
 or literally create a new file? I have no existing databases to work
 with... (what's the file extension for a MySQL-type database anyway [i.e.,
 MS Access = .MDB, MySQL = ?] ?)

The problem is that you haven't read the (mysql) manual. Either read the 
manual or search out (and read) the numerous tutorials that are available.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Dogs just don't seem to be able to tell the difference between important 
people
and the rest of us.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] MySQL - Creating The Database

2002-06-04 Thread David Freeman


  Am I correct in saying that none of the SQL functions in PHP 
  can actually create a database file when no file existed 
  before? In other words, an empty database file must exist 
  before SQL functions can be called on it?

If you have appropriate access you can.  You do need 'root' access to
the mysql server to do it of course.

From memory, you also have a few php commands that will help - why not
consult your local friendly php manual in the section under mysql
commands for choices and information.

CYA, Dave


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Marek Kilimajer

You cannot create a database from within PHP, you need to connect to mysql server 
( my guess is the same applies to MS Access), and with root priviledges call 
something like 

mysql_query(CREATE TABLE nuke_stories (
  sid int(11) NOT NULL auto_increment,
  catid int(11) NOT NULL default '0',
  aid varchar(30) NOT NULL default '',
  title varchar(80) default NULL,
  time datetime default NULL,
  hometext text,
  bodytext text NOT NULL,
  comments int(11) default '0',
  counter mediumint(8) unsigned default NULL,
  topic int(3) NOT NULL default '1',
  informant varchar(20) NOT NULL default '',
  notes text NOT NULL,
  ihome int(1) NOT NULL default '0',
  alanguage varchar(30) NOT NULL default '',
  acomm int(1) NOT NULL default '0',
  haspoll int(1) NOT NULL default '0',
  pollID int(10) NOT NULL default '0',
  score int(10) NOT NULL default '0',
  ratings int(10) NOT NULL default '0',
  PRIMARY KEY  (sid)
) TYPE=MyISAM;);

this query you can create at your local computer.
You can also use phpMyAdmin, web interface to mysql.


Jason Teagle wrote:

- Original Message -
From: David Freeman [EMAIL PROTECTED]
To: 'PHP Mailing List' [EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 11:50 AM
Subject: RE: [PHP] MySQL - Creating The Database


  

Ummm, not sure exactly what you're asking but you can use mysql_query to
issue the relevant sql commands to create your database and tables and



Am I correct in saying that none of the SQL functions in PHP can actually
create a database file when no file existed before? In other words, an empty
database file must exist before SQL functions can be called on it?

  

so on.  In cases where I want to package something that kicks off I
usually create an install script that looks for the database I need and
if it doesn't exist then create it.



This is the problem - how _do_ you create it? What does your install script
do? Copy a blank template of a DB from a file in your installation package,
or literally create a new file? I have no existing databases to work with...
(what's the file extension for a MySQL-type database anyway [i.e., MS Access
= .MDB, MySQL = ?] ?)

  

Obviously if you actually want to test code on your development box then
you're going to need an actual sql server to do it.



That's no problem for me - I'm testing directly on the (remote) host anyway.
Better to test where it's going to be finally then get it all working
perfectly here and find it doesn't work there {:v)


_ _
o oJason Teagle
   [EMAIL PROTECTED]
 v



  




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Michael Hall


If your site is hosted in a *nix machine with shell access, another option
might be to create a database and write up the SQL you need to structure
it in a text file, then just feed it straight into MySQL like this:

mysqladmin -uusername -ppassword create yourdatabase
mysql -uusername -ppassword yourdatabase  yoursqlfile

Provided you have the access and permissions, it's that simple.

Michael

On Tue, 4 Jun 2002, Jason Wong wrote:

 On Tuesday 04 June 2002 19:03, Jason Teagle wrote:
 
   Ummm, not sure exactly what you're asking but you can use mysql_query to
   issue the relevant sql commands to create your database and tables and
 
  Am I correct in saying that none of the SQL functions in PHP can actually
  create a database file when no file existed before? In other words, an
  empty database file must exist before SQL functions can be called on it?
 
 As the guy said, use mysql_query() to issue the sql commands to create the 
 database:
 
  CREATE DATABASE my_database;
 
  This is the problem - how _do_ you create it? What does your install script
  do? Copy a blank template of a DB from a file in your installation package,
  or literally create a new file? I have no existing databases to work
  with... (what's the file extension for a MySQL-type database anyway [i.e.,
  MS Access = .MDB, MySQL = ?] ?)
 
 The problem is that you haven't read the (mysql) manual. Either read the 
 manual or search out (and read) the numerous tutorials that are available.
 
 

-- 

n   i   n   t   i  .   c   o   m
php-python-perl-mysql-postgresql

Michael Hall [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jason Teagle

David Freeman said:

 From memory, you also have a few php commands that will help - why not
 consult your local friendly php manual in the section under mysql
 commands for choices and information.


Jason Wong:

The problem is that you haven't read the (mysql) manual. Either read the
manual or search out (and read) the numerous tutorials that are available.

Gentlemen,
to be fair, it is customary to get all the tools and other preparations
(including necessary files) ready before embarking on a project. Thus, it is
logical to get a blank database ready before beginning. Why read yards of
documentation before you even have something to practice on as you go? I
didn't try reading the PHP manual before I was able to run PHP scripts
somewhere, so I don't try reading the MySQL manual before having a database
to work on.

Also, if a person doesn't _know_ that PHP can create a database for you, how
would they know that somewhere in the list of PHP functions is the answer to
the problem? It would be foolish to expect someone to read the _whole_ of
the documentation on MySQL or PHP just to see if there is such a thing,
there's just too much of it.


_ _
o oJason Teagle
   [EMAIL PROTECTED]
 v



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jason Wong

On Tuesday 04 June 2002 19:59, Jason Teagle wrote:

 to be fair, it is customary to get all the tools and other preparations
 (including necessary files) ready before embarking on a project. Thus, it
 is logical to get a blank database ready before beginning. Why read yards
 of documentation before you even have something to practice on as you go? I
 didn't try reading the PHP manual before I was able to run PHP scripts
 somewhere, so I don't try reading the MySQL manual before having a database
 to work on.

If you can get by without reading manuals then good luck to you.

 Also, if a person doesn't _know_ that PHP can create a database for you,
 how would they know that somewhere in the list of PHP functions is the
 answer to the problem? It would be foolish to expect someone to read the
 _whole_ of the documentation on MySQL or PHP just to see if there is such a
 thing, there's just too much of it.

I hope it's not foolish to expect someone to be able to /search/ for the 
relevant information. In this day of electronic information there's no need 
to flip through page after page looking for what you need. And even a printed 
book should have a table of contents and an index to make looking up 
information quick and painless.

That is why I said if you can't be bothered to read the manual, at least find 
a tutorial. There are _plenty_ of tutorials on how to get started with PHP + 
MySQL.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Harriet's Dining Observation:
In every restaurant, the hardness of the butter pats
increases in direct proportion to the softness of the bread.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] MySQL - Creating The Database

2002-06-04 Thread David Freeman


  Also, if a person doesn't _know_ that PHP can create a 
  database for you, how would they know that somewhere in the 
  list of PHP functions is the answer to the problem? It would 
  be foolish to expect someone to read the _whole_ of the 
  documentation on MySQL or PHP just to see if there is such a 
  thing, there's just too much of it.

With respect, CRAP!  If you're serious about your trade then you owe it
to yourself to learn about it.  OK, here's what I've just done - not
that I didn't have better things to do but anyway...

1.  Load up www.php.net - you know it exists, you're programming in php
after all.

2.  Click on the funky little 'documentation' link in the top right hand
side - it's also pretty easy to find.

3.  Select your format - in my case, I chose to view online and the
english version.  I suspect this is also an easy decision that doesn't
involve the massive weight of there's just too much of it.

4.  Hmm, I want to do something related to mysql... Section IV of the
manual is Function Reference and section LXII is MySQL Functions -
still no real work involved here.

5.  Somewhere about half way down that page is a list of all relevant
functions.  One of them is mysql_create_db - Well!  Look at that!  Might
help me out if I read the function explanation.

 -- OR --

Find out how to do it in pure MySQL - that would be done by reading the
MySQL manual which is also available online.  I'll admit that I've often
found the mysql offering a little harder to navigate but I always seem
to manage to find what I'm looking for.

If you're serious about it, do some research about it.  At least come
back to a high volume list being able to say something about what you've
tried instead of asking others to do your research (thinking?) for you.

Sorry if you're affronted by this but learning to use your chosen tools
is part of the job.

CYA, Dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Jason Teagle


- Original Message -
From: David Freeman [EMAIL PROTECTED]
To: 'Jason Teagle' [EMAIL PROTECTED]; 'PHP Mailing List'
[EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 1:58 PM
Subject: RE: [PHP] MySQL - Creating The Database

How very sad. It's not new - I've seen things like this on many lists and
newsgroups. Apparently it is easier for people to be sarcastic and give a
flippant RTFM response than to actually help people. The only list I've ever
seen that actually treated newcomers with a bit of respect in most cases is
WinDev.

Here's an example of what a good answer would have been:

MySQL databases aren't single files like other types. They're like
directories with files as tables.
PHP itself can create a database, take a look at mysql_connect(),
mysql_query() and the CREATE DATABASE SQL action.

See? It gives the answer, involves no sarcasm or mockery, and above all,
actually HELPS the OP.

But no... being a smart-ass is easier, right?

The trouble with wise guys like these is that they assume:

1) That the OP has not bothered to try to find the answer.
We're not all geniuses, we can't all think laterally all the time, we can't
all come up with the right way of finding the answer. For the record, I
_did_ look online using Google and _did_ look around the PHP manual, but was
unlucky enough not to end up on the route that shows mysql_create_db(). My
misfortune.

2) That the OP already knows the answer.
Coming from a number of other programming languages where it is not possible
to create a database programmatically, it is natural to assume that the same
might be true of PHP. Had I known that PHP could create it from scratch, I
would not have needed to deal with this pathetic situation. But I didn't
know, so I stupidly thought that I might get some help from a list
pretending to help people trying to program in PHP.

Obviously, I was wrong. Also my misfortune.

Don't bother responding, I have left the list. Plenty of places where people
are actually willing to help.


_ _
o oJason Teagle
   [EMAIL PROTECTED]
 v



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Christopher Riordan

He'll Be Back, they all come back

Chris

- Original Message -
From: Jason Teagle [EMAIL PROTECTED]
To: PHP Mailing List [EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 9:45 AM
Subject: Re: [PHP] MySQL - Creating The Database



 - Original Message -
 From: David Freeman [EMAIL PROTECTED]
 To: 'Jason Teagle' [EMAIL PROTECTED]; 'PHP Mailing List'
 [EMAIL PROTECTED]
 Sent: Tuesday, June 04, 2002 1:58 PM
 Subject: RE: [PHP] MySQL - Creating The Database

 How very sad. It's not new - I've seen things like this on many lists and
 newsgroups. Apparently it is easier for people to be sarcastic and give a
 flippant RTFM response than to actually help people. The only list I've
ever
 seen that actually treated newcomers with a bit of respect in most cases
is
 WinDev.

 Here's an example of what a good answer would have been:

 MySQL databases aren't single files like other types. They're like
 directories with files as tables.
 PHP itself can create a database, take a look at mysql_connect(),
 mysql_query() and the CREATE DATABASE SQL action.

 See? It gives the answer, involves no sarcasm or mockery, and above all,
 actually HELPS the OP.

 But no... being a smart-ass is easier, right?

 The trouble with wise guys like these is that they assume:

 1) That the OP has not bothered to try to find the answer.
 We're not all geniuses, we can't all think laterally all the time, we
can't
 all come up with the right way of finding the answer. For the record, I
 _did_ look online using Google and _did_ look around the PHP manual, but
was
 unlucky enough not to end up on the route that shows mysql_create_db(). My
 misfortune.

 2) That the OP already knows the answer.
 Coming from a number of other programming languages where it is not
possible
 to create a database programmatically, it is natural to assume that the
same
 might be true of PHP. Had I known that PHP could create it from scratch, I
 would not have needed to deal with this pathetic situation. But I didn't
 know, so I stupidly thought that I might get some help from a list
 pretending to help people trying to program in PHP.

 Obviously, I was wrong. Also my misfortune.

 Don't bother responding, I have left the list. Plenty of places where
people
 are actually willing to help.

 
 _ _
 o oJason Teagle
[EMAIL PROTECTED]
  v
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MySQL - Creating The Database

2002-06-04 Thread Juan Pablo Aqueveque

ops! ops! ops!

I wonder : Who does have the reason in this discussion?
Mr. Jason Teagle or Mr. David Freeman

Being honest, I would say 50% and 50%.


At 09:45 04/06/02, Jason Teagle wrote:

- Original Message -
From: David Freeman [EMAIL PROTECTED]
To: 'Jason Teagle' [EMAIL PROTECTED]; 'PHP Mailing List'
[EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 1:58 PM
Subject: RE: [PHP] MySQL - Creating The Database

How very sad. It's not new - I've seen things like this on many lists and
newsgroups. Apparently it is easier for people to be sarcastic and give a
flippant RTFM response than to actually help people. The only list I've ever
seen that actually treated newcomers with a bit of respect in most cases is
WinDev.

Here's an example of what a good answer would have been:

MySQL databases aren't single files like other types. They're like
directories with files as tables.
PHP itself can create a database, take a look at mysql_connect(),
mysql_query() and the CREATE DATABASE SQL action.

See? It gives the answer, involves no sarcasm or mockery, and above all,
actually HELPS the OP.

But no... being a smart-ass is easier, right?

The trouble with wise guys like these is that they assume:

1) That the OP has not bothered to try to find the answer.
We're not all geniuses, we can't all think laterally all the time, we can't
all come up with the right way of finding the answer. For the record, I
_did_ look online using Google and _did_ look around the PHP manual, but was
unlucky enough not to end up on the route that shows mysql_create_db(). My
misfortune.

2) That the OP already knows the answer.
Coming from a number of other programming languages where it is not possible
to create a database programmatically, it is natural to assume that the same
might be true of PHP. Had I known that PHP could create it from scratch, I
would not have needed to deal with this pathetic situation. But I didn't
know, so I stupidly thought that I might get some help from a list
pretending to help people trying to program in PHP.

Obviously, I was wrong. Also my misfortune.

Don't bother responding, I have left the list. Plenty of places where people
are actually willing to help.


_ _
o oJason Teagle
[EMAIL PROTECTED]
  v



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Juan Pablo Aqueveque [EMAIL PROTECTED]
Ingeniero de Sistemas
Departamento de Redes y Comunicaciones http://www.drc.uct.cl
Universidad Católica de Temuco.
Tel:(5645) 205 630 Fax:(5645) 205 628


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] MySQL - Creating The Database

2002-06-04 Thread Naintara Jain

This is rather sad, the PHP mailing list is pretty good.
Agreed, sometimes the answers are curt, that's because a lot of the
questions have been asked a zillion times and can be found in the archives.
And sometimes there's no response, perhaps the solution is not evident to
those on the list.

But I think there is such a thing as too much of a good thing.
Very often the entire solution comes so readily through the list, that
newbies tend to turn to the list for every little thing.

It would help the newbie to do his/her research before turning to the list.
And it would help in keeping the list healthy too. Try the CHM PHP4 manual,
the site www.php.net and its partner sites.

So, do a bit of research and when you can truly truly say that you give up,
then the smart-asses are here to help you out.

cheers.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
t]On Behalf Of Christopher Riordan
Sent: Tuesday, June 04, 2002 6:51 AM
To: PHP Mailing List
Subject: Re: [PHP] MySQL - Creating The Database


He'll Be Back, they all come back

Chris

- Original Message -
From: Jason Teagle [EMAIL PROTECTED]
To: PHP Mailing List [EMAIL PROTECTED]
Sent: Tuesday, June 04, 2002 9:45 AM
Subject: Re: [PHP] MySQL - Creating The Database



 - Original Message -
 From: David Freeman [EMAIL PROTECTED]
 To: 'Jason Teagle' [EMAIL PROTECTED]; 'PHP Mailing List'
 [EMAIL PROTECTED]
 Sent: Tuesday, June 04, 2002 1:58 PM
 Subject: RE: [PHP] MySQL - Creating The Database

 How very sad. It's not new - I've seen things like this on many lists and
 newsgroups. Apparently it is easier for people to be sarcastic and give a
 flippant RTFM response than to actually help people. The only list I've
ever
 seen that actually treated newcomers with a bit of respect in most cases
is
 WinDev.

 Here's an example of what a good answer would have been:

 MySQL databases aren't single files like other types. They're like
 directories with files as tables.
 PHP itself can create a database, take a look at mysql_connect(),
 mysql_query() and the CREATE DATABASE SQL action.

 See? It gives the answer, involves no sarcasm or mockery, and above all,
 actually HELPS the OP.

 But no... being a smart-ass is easier, right?

 The trouble with wise guys like these is that they assume:

 1) That the OP has not bothered to try to find the answer.
 We're not all geniuses, we can't all think laterally all the time, we
can't
 all come up with the right way of finding the answer. For the record, I
 _did_ look online using Google and _did_ look around the PHP manual, but
was
 unlucky enough not to end up on the route that shows mysql_create_db(). My
 misfortune.

 2) That the OP already knows the answer.
 Coming from a number of other programming languages where it is not
possible
 to create a database programmatically, it is natural to assume that the
same
 might be true of PHP. Had I known that PHP could create it from scratch, I
 would not have needed to deal with this pathetic situation. But I didn't
 know, so I stupidly thought that I might get some help from a list
 pretending to help people trying to program in PHP.

 Obviously, I was wrong. Also my misfortune.

 Don't bother responding, I have left the list. Plenty of places where
people
 are actually willing to help.

 
 _ _
 o oJason Teagle
[EMAIL PROTECTED]
  v
 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.363 / Virus Database: 201 - Release Date: 05/21/2002


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php