1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    Hi, I'm new to web programming, but trying to learn the best options for doing database access from html to a msql database on an apache server running linux. I have a programming backround, just new to the web.

    My questions are:
    1. Can I access the database from a client side script (javascript or cgi?)
    2. What are my options for using a server side script. From what I can determine they are:

    W3-msql (lite programming -included in msql)
    Embedded perl
    Jserv (Java Servlets)

    I don't know any of these tools, but am ready to learn. Any ideas on what is the easist and what is the best (these are not necessarily the same)? Any advice is appreciated. Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    London, England
    Rep Power
    Cool! You are at the start of a great adventure!

    First, forget client-side. It's not designed for this sort of stuff.

    CGI is *server* side. It's a convention for passing parameters to a server-side script, not a language in itself. For example, Perl uses CGI and Perl programs (and others) are sometimes called "CGI scripts" leading to some confusion.

    To declare my own interest, I write Perl that accesses MySQL. This is quite standard, though a lot of people use PHP and it is generally considered "easier to learn". "Best" and "easiest" are highly subjective terms. From a functional point of view, what you're planning to do is probably quite straightforward. Take form input, put it in a database. Take form input, query the database and display the results. It's not rocket science and an awful lot easier IMHO than say event-driven GUI stuff.

    Also you refer to msql but MySQL is more commonly used, free(ish) and more powerful so it's a better one to go for. Though from a programming point of view they're extremely similar.

    As you're already a programmer I'd say learn Perl and go that route. If you can do C, for instance, then Perl is a doddle. And of course there are lots of useful things you can do with Perl away from the web too.

    For a cheap and easy intro to Perl/CGI, get Perl and CGI for the WWW by Elizabeth Castro. This doesn't cover databases but will get you started writing Perl scripts without bogging you down in heavy theory or irrelevant and silly topics.

    Check out www.perl.com

    Also "Programming the Perl DBI" by Descartes/Bunce is *the* book on Perl database access. MySQL & msql by Yarger/Reese/King is also useful but not essential.

    I'm not claiming some ultimate truth here. There are many ways of approaching this. But this is the route that worked for me coming from the same place as you.

    Given time, learn them all! (Why not?)
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Perth West Australia
    Rep Power

    I have to agree with Adrian regarding client side - forget it however....

    If however you expect to be doing a lot of database work - and/or form/mail work - please take a look at PHP first, as Adrian rightly says if you know C etc you will probably pick up PERL quick smartish - in fact you may already know it because it is not a web-based language.

    This is its major downfall - PHP was written specifically for the web and data access, a trained chimp can pick up the gist of PHP, not to say it is not a very powerful language because it is - its just easy as well!

    PHP has built in functions for all major (and minor) data sources, working with forms could not possibly be easier, mail functions are too easy to be considered true etc etc , just take a look in the PHP forums here on devshed - read through some of the Q&A and take a look at the manual online at http://www.php.net before you decide which way to go.

    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

IMN logo majestic logo threadwatch logo seochat tools logo