By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,877 Members | 1,064 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,877 IT Pros & Developers. It's quick & easy.

PHP code/libraries for creating MySQL databases

P: n/a
Hi All,

I am working on a registration system, and one of the things I am going to
need to be able to do it setup the database tables for each event that I
have registration for. Normally I would do this by hand, but I am wondering
if there are any code libraries out there that could generate the SQL for
me.

Basically I would have a list of column names and types. I know I could
just foreach() through the list, with a switch to divert control to the
different code segments depending on the column type, and at the end I would
have the SQL generated.

This seems like the sort of thing that somebody might have done before and
released a code snippet for. Maybe in PEAR DB? Any ideas?

Sincerely,
-Josh
Jul 17 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Why on earth don't you use phpMyAdmin? Everybody else does. Visit
http://www.phpmyadmin.net and download the source.

--
Tony Marston

http://www.tonymarston.net


"Joshua Beall" <jb****@donotspam.remove.me.heraldic.us> wrote in message
news:p2bId.10812$ef6.10589@trnddc07...
Hi All,

I am working on a registration system, and one of the things I am going to
need to be able to do it setup the database tables for each event that I
have registration for. Normally I would do this by hand, but I am
wondering if there are any code libraries out there that could generate
the SQL for me.

Basically I would have a list of column names and types. I know I could
just foreach() through the list, with a switch to divert control to the
different code segments depending on the column type, and at the end I
would have the SQL generated.

This seems like the sort of thing that somebody might have done before and
released a code snippet for. Maybe in PEAR DB? Any ideas?

Sincerely,
-Josh

Jul 17 '05 #2

P: n/a
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:cs*******************@news.demon.co.uk...
Why on earth don't you use phpMyAdmin? Everybody else does. Visit
http://www.phpmyadmin.net and download the source.


I must not have asked my question clearly enough - I do not need an end user
application. I was looking for a code library

Scraping the bits I want out of phpMyAdmin is of course an option. But I
was wondering if there was an existing libraries out there that I could just
drop in to place (or include() in place, as the case may be).
Jul 17 '05 #3

P: n/a
I noticed that Message-ID: <p2bId.10812$ef6.10589@trnddc07> from Joshua
Beall contained the following:
I am working on a registration system, and one of the things I am going to
need to be able to do it setup the database tables for each event that I
have registration for. Normally I would do this by hand, but I am wondering
if there are any code libraries out there that could generate the SQL for
me.


A table for each event? Are you sure you mean that?
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4

P: n/a
"Geoff Berrow" <bl@ckdog.co.uk> wrote in message
news:qo********************************@4ax.com...
I noticed that Message-ID: <p2bId.10812$ef6.10589@trnddc07> from Joshua
Beall contained the following:
I am working on a registration system, and one of the things I am going to
need to be able to do it setup the database tables for each event that I
have registration for. Normally I would do this by hand, but I am
wondering
if there are any code libraries out there that could generate the SQL for
me.


A table for each event? Are you sure you mean that?


Do you have another suggestion? I couldn't think of any other way to do it,
since the information collected for each event will be different (possibly
*very* different).

I'm open to new ideas, though.
Jul 17 '05 #5

P: n/a
I noticed that Message-ID: <MJbId.3567$BL3.3361@trnddc01> from Joshua
Beall contained the following:
A table for each event? Are you sure you mean that?


Do you have another suggestion? I couldn't think of any other way to do it,
since the information collected for each event will be different (possibly
*very* different).


Ah I see what you mean. So an event is like a conference and you want
to store delegate details. Some events may just want name and address
some may want name address, flight details, nationality and so on?

I still don't see why you can't use phpMyadmin to create the tables...
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #6

P: n/a
ncf
Why not use one table to hold all the events, and another to hold the
details or whatever you need to hold and the ID of the event. Then you
can access it with a query such as

SELECT * FROM events AS e JOIN details AS d ON (e.id=d.event_id)
Best of Luck.

-Wes

Jul 17 '05 #7

P: n/a
"Geoff Berrow" <bl@ckdog.co.uk> wrote in message
news:oh********************************@4ax.com...
Do you have another suggestion? I couldn't think of any other way to do
it,
since the information collected for each event will be different (possibly
*very* different).
Ah I see what you mean. So an event is like a conference and you want
to store delegate details. Some events may just want name and address
some may want name address, flight details, nationality and so on?


Right, exactly.
I still don't see why you can't use phpMyadmin to create the tables...


Well, I *could*, I'm just wondering if there is a way I could automate the
process. See, my end goal is to just be able to write up an XML file that
describes the conference (name, fields, what fields are required, etc), and
then be able to run a script that will generate the form to collect the
information and the table where that info will be stored.

But I think where I'm landing for now is to just do make the table by hand.
Some time down the road I may try and make it more automated.
Jul 17 '05 #8

P: n/a
"ncf" <no***************@gmail.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Why not use one table to hold all the events, and another to hold the
details or whatever you need to hold and the ID of the event. Then you
can access it with a query such as

SELECT * FROM events AS e JOIN details AS d ON (e.id=d.event_id)


The thing is that this would produce multiple rows for one entry in the
events table. I'd rather not do that. :-/
Jul 17 '05 #9

P: n/a
Joshua Beall wrote:
"Geoff Berrow" <bl@ckdog.co.uk> wrote in message
news:oh********************************@4ax.com...
Do you have another suggestion? I couldn't think of any other way to do
it,
since the information collected for each event will be different (possibly
*very* different).


Ah I see what you mean. So an event is like a conference and you want
to store delegate details. Some events may just want name and address
some may want name address, flight details, nationality and so on?

Right, exactly.

I still don't see why you can't use phpMyadmin to create the tables...

Well, I *could*, I'm just wondering if there is a way I could automate the
process. See, my end goal is to just be able to write up an XML file that
describes the conference (name, fields, what fields are required, etc), and
then be able to run a script that will generate the form to collect the
information and the table where that info will be stored.

But I think where I'm landing for now is to just do make the table by hand.
Some time down the road I may try and make it more automated.

I have found that cut and paste is my friend. For me it is
faster and easier to create model procedures and then modify
them to suit individual applications/tables. Use your favorite
editor to build three php programs, one to create a table with a
primary key and one to generate a form to collect the data to be
used in populating the table and one to process and store the
data.

To handle a new event copy the three progams, edit, execute,
test and verify the results. You should be able to add a new
event in less than ten minutes.

HTH
Jerry
Jul 17 '05 #10

P: n/a
It now appears that the problem your were asking this newsgroup to solve was
totally unrelated to the subject line.

"PHP code/libraries for creating MySQL databases" is about CREATING
databases, not maintaining the contents of databases.

If you do not ask the right question then how are we supposed to supply the
right answer?

If you want to look at the method I have created for automating this process
then take a look at the following articles:

http://www.tonymarston.co.uk/php-mys...seobjects.html
http://www.tonymarston.co.uk/php-mys...eobjects2.html
http://www.tonymarston.co.uk/php-mys...structure.html
http://www.tonymarston.co.uk/php-mys...plication.html

The last article contains a link where you can run my sample application
online, with another to download the source code to see how it's done.

Hope this helps.

--
Tony Marston

http://www.tonymarston.net

"Jerry Gitomer" <jg******@verizon.net> wrote in message
news:sTkId.7849$hC2.6999@trndny04...
Joshua Beall wrote:
"Geoff Berrow" <bl@ckdog.co.uk> wrote in message
news:oh********************************@4ax.com...
Do you have another suggestion? I couldn't think of any other way to do
it,
since the information collected for each event will be different
(possibly
*very* different).

Ah I see what you mean. So an event is like a conference and you want
to store delegate details. Some events may just want name and address
some may want name address, flight details, nationality and so on?

Right, exactly.

I still don't see why you can't use phpMyadmin to create the tables...

Well, I *could*, I'm just wondering if there is a way I could automate
the process. See, my end goal is to just be able to write up an XML file
that describes the conference (name, fields, what fields are required,
etc), and then be able to run a script that will generate the form to
collect the information and the table where that info will be stored.

But I think where I'm landing for now is to just do make the table by
hand. Some time down the road I may try and make it more automated.

I have found that cut and paste is my friend. For me it is faster and
easier to create model procedures and then modify them to suit individual
applications/tables. Use your favorite editor to build three php
programs, one to create a table with a primary key and one to generate a
form to collect the data to be used in populating the table and one to
process and store the data.

To handle a new event copy the three progams, edit, execute, test and
verify the results. You should be able to add a new event in less than
ten minutes.

HTH
Jerry

Jul 17 '05 #11

P: n/a
In article <8AbId.3566$BL3.127@trnddc01>,
"Joshua Beall" <jb****@donotspam.remove.me.heraldic.us> wrote:
"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:cs*******************@news.demon.co.uk...
Why on earth don't you use phpMyAdmin? Everybody else does. Visit
http://www.phpmyadmin.net and download the source.


I must not have asked my question clearly enough - I do not need an end user
application. I was looking for a code library

Scraping the bits I want out of phpMyAdmin is of course an option. But I
was wondering if there was an existing libraries out there that I could just
drop in to place (or include() in place, as the case may be).


Yeah, after reading this thread, I'm still confused about what you're
trying to do and what your requirements are. A class with functions to
manipulate MySQL databases? Something to populate an existing database?

For a class, there are a number of things out there. There's PEAR's DB.
I use an SQL class I got from http://www.phpclasses.org

Try explaining more fully what your trying to accomplish rather than a
solution.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

Jul 17 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.