Welcome to WebmasterWorld Guest from 184.73.8.127

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

how to set up a simple database?

need to start learning I guess

   
12:34 am on Jul 12, 2007 (gmt 0)

10+ Year Member



I can't seem to find a script for this, but maybe I have not looked hard enough.

I need a user on my site to be able to fill in 2 fields on my site and if they match, return a third field.

basically it would be their Last Name and Zip code, if this matched it would show the expiration date of their membership.

the database would just be the 3 fields and maybe 2000 records.

I just don't know where to start on this.

my webhost has MySql, PHP, etc.

(note: this is related to a club membership that is not web-based, people get a magazine and want to have a simple way to find out when it expires. Right now they send emails or call me even though it is actually printed on their magazine)

5:49 am on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



First you need to know how to deal with forms with PHP. Here's a good place to start: Dealing with Forms [us.php.net].

Next you need to setup a table in your database. Refer here: create table syntax [dev.mysql.com]. If you have phpmyadmin this process is easier.

After that you need to know how to 'talk' to mysql with php. For that, we have a few great threads in the php forum library that should get you moving along. Here are a few:
basics of extracting data from mysql [webmasterworld.com]
commonly used mysql commands [webmasterworld.com]

And don't forget to check the documentation at php.net and mysql.com. That shold get you started.

Happy coding ;)

9:32 am on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use Mysql for a three field, 2000 record, single dataset file?

That's like using a Ferrari to ferry the children one mile to school, very expensive, and excessive.

You can just use a simple text flat file, one record per line and separate the fields with a simple delimiter. Very fast, very simple.

Matt

3:37 pm on Jul 12, 2007 (gmt 0)

10+ Year Member



I would be happy to use a simple flat file as I just export the info I need out of Filemaker, but once I have the flat file, I don't know what to do with it.?
I remember I asked this question once before someplace and one answer was to post all the info as a single HTML web page and then draw on that, but I could not get anyone to explain how.
Apparently it is so simple that it cannot be explained.

I only mentioned that MySql and PHP are installed on my webserver in case anyone asked. If I can avoid using MySQL, that would be great.
I just use that for the premade forum and photoposting programs that I installed. All the heavy lifting is done.

I will look at the "Dealing with Forms" link, thank you.
I am viewing this as a learning experience so I plan to start *very* small and work my work my way up. Its a hobby job, not a work job.

7:05 pm on Jul 12, 2007 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



If you are going to use a CSV file PHP comes with a nice little function: fgetcsv [us.php.net].

There is a nice thread in the library: the basics of extracting data from a csv file [webmasterworld.com].