PDA

View Full Version : php/mysql


george
12-14-2005, 07:31 AM
forgive me for this newbie/lazy question...

i need to create a system to store multiple sets of license keys and distribute them from my website. first i used php to create a simple flat file database consisting of multiple text files, but then i learned that flock() is not very reliable, especially with multithreaded servers... of course i don't want the same license key sent twice to two different customers.... so i need to use mysql for the best reliability, correct?

problem is, i've NEVER used mysql, let alone any other database. my webhost gives me one mysql database, so let me know if this is possible:

can i have a single database contain multiple different sets of data, i.e. two sets of license key lists (like one from personal version, one for professional version), customer download list, etc.? how does that work??? something to do with mysql records which i read somewhere??? oh, and is phpmyadmin good, that's what my webhost gave me?

as you can see, i have no idea what i'm talking about :) my searches on google have failed thus far... also, if u know a good tutorial on using php/mysql please give me the link...

please give me any info you can... after developing a project for over a year, this is the last thing i wanna do now - i know u guys know the feeling. thanks!

Savant
12-14-2005, 07:36 AM
You can create multiple tables within that single database so that's not really a problem. PHP can easily access MySQL databases so don't sweat that either.

PHPMyAdmin is OK if you have nothing else. It's clunky though. I use NaviCat (http://www.navicat.com/) and it's been beautiful. It's not free but it's worth every penny. You can do everything from within it's interface - create new tables, look at data, change data, create queries, back up the database, etc. Great product.

MadSage
12-14-2005, 07:40 AM
A single database can contain multiple tables, so yes you could have two key lists, a download list etc.

For an easy to follow SQL tutorial, check out:
http://www.w3schools.com/sql/default.asp

Probably the best place to learn how to use MySQL from PHP is the PHP manual:
http://uk.php.net/manual/en/ref.mysql.php

If you need more detailed information on MySQL, there is of course the MySQL manual:
http://dev.mysql.com/doc/


I've done PHP websites with MySQL and I'm currently working on MMOG servers written in C++ and using MySQL. Everything I know came from those three sites above :)

BarrySlisk
12-14-2005, 08:50 AM
SAMS "Teach yourself PHP in 24 hours" is a very good introduction to PHP and MySQL.

Shagwana
12-14-2005, 10:03 AM
Im currently reading through PHP and MySQL Web Development (2nd edition) by Welling Thomson (ISBN 0-672-32525-X). Its very good!

Also, found this link a while ago http://www.tizag.com/mysqlTutorial/index.php that might be of use ;)

soniCron
12-14-2005, 10:25 AM
I haven't tried it, but GalaXQL (http://iki.fi/sol/galaxql.html) looks like a really cool idea. Either way, learning SQL is really simple. Get yourself Uniform Server (http://www.uniformserver.com/) to test mySQL out on your PC. Saves from all the uploading.

revve
12-14-2005, 10:37 AM
I agree a local web/mysql/php server is essential if you do any sort of php development. I personally use apache2triad (http://apache2triad.net/), but there's plenty of variations to choose from. The main reason I chose apache2triad was that it comes with a nice little web based gui to administer everything (I'm too lazy to use config files for all my development servers). It also comes with everything (apache, php, mysql, postgresql, python, perl, ftp, ssl, the kitchen sink), so pretty much anything you need to do is included. The downside is a huge download and even bigger install.

george
12-14-2005, 03:47 PM
Thank You So Much Guys!

:)

digriz
12-15-2005, 03:47 AM
I use this this (http://www.apachefriends.org/en/)..It's called apache friends and it's a 1-click installer for mySQL, php and a couple of other nice things.

It will set up your pc to handle php & mySQL quite nicely. I've never had a problem with it at all.

One thing to remember is that a lot of hosts require you to prepend something to the database name when it's running off their servers. for instance, if your website is called george.com and your mySQL file is called generic, then they will require the call to the database name to be george_generic. This isn't necessary when you're testing it locally. If you have problems when going live, then chances are this is an initial pitfall.

MadSage
12-15-2005, 04:15 AM
I always put the database name, username, and password in a config.php file for that reason.