PHP code/libraries for creating MySQL databases

This is a discussion on PHP code/libraries for creating MySQL databases within the PHP Language forums, part of the PHP Programming Forums category; Hi All, I am working on a registration system, and one of the things I am going to need to ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-21-2005
Joshua Beall
 
Posts: n/a
Default PHP code/libraries for creating MySQL databases

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


Reply With Quote
  #2 (permalink)  
Old 01-21-2005
Tony Marston
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

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" <jbeall@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
>



Reply With Quote
  #3 (permalink)  
Old 01-21-2005
Joshua Beall
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

"Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message
news:csrfv2$6ua$1$830fa17d@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).


Reply With Quote
  #4 (permalink)  
Old 01-21-2005
Geoff Berrow
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

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/
Reply With Quote
  #5 (permalink)  
Old 01-21-2005
Joshua Beall
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

"Geoff Berrow" <bl@ckdog.co.uk> wrote in message
news:qoh2v0tvr0a1vn9g32pqi6i3nopc3jvhub@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.


Reply With Quote
  #6 (permalink)  
Old 01-21-2005
Geoff Berrow
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

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/
Reply With Quote
  #7 (permalink)  
Old 01-21-2005
ncf
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

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

Reply With Quote
  #8 (permalink)  
Old 01-21-2005
Joshua Beall
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

"Geoff Berrow" <bl@ckdog.co.uk> wrote in message
news:ohl2v01en4uj0nqcuusobanmgcef8lu3l7@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.


Reply With Quote
  #9 (permalink)  
Old 01-21-2005
Joshua Beall
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

"ncf" <nothingcanfulfill@gmail.com> wrote in message
news:1106336931.467726.132010@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. :-/


Reply With Quote
  #10 (permalink)  
Old 01-22-2005
Jerry Gitomer
 
Posts: n/a
Default Re: PHP code/libraries for creating MySQL databases

Joshua Beall wrote:
> "Geoff Berrow" <bl@ckdog.co.uk> wrote in message
> news:ohl2v01en4uj0nqcuusobanmgcef8lu3l7@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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:11 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0