Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Linking PERL script to an MS Access Database or MYSQL

den_santiagoden_santiago Member Posts: 13
I am currently working on a web site on my computer running on an APACHE Web Server with PHP, PERL and MYSQL. I need to link my web page to an MYSQL Database on its table or to an MS ACCESS Database via ODBC. What do I need to do this? Is there any tutorial site that can help me? Any help will be greatly appreciated.

Comments

  • JonathanJonathan Member Posts: 2,914
    : I am currently working on a web site on my computer running on an APACHE Web Server with PHP, PERL and MYSQL. I need to link my web page to an MYSQL Database on its table or to an MS ACCESS Database via ODBC. What do I need to do this? Is there any tutorial site that can help me? Any help will be greatly appreciated.
    :

    Hi,

    I'm not certain on Access, but for MySQL you can use the Perl DBI. Just put this at the top of a script:-

    use DBI;

    And that includes the module. If your scripts won't run now, you need to install the DBI module and appropriate Database Drivers using ppm (Perl Package Manager) or through another method.

    To connect to database:-

    $dbh = DBI->connect("DBI:mysql:database:host", "username", "password");

    Where database is the name of the database, host is the hostname of the database server and username and passowrd are the username and password of the database.

    To do any query where you don't expect a result:-

    $dbh->do(qq{
    INSERT INTO procducts
    (name, description, price)
    VALUES '$name', '$description', '$price')
    });

    To do a select...

    my $sth = $dbh->prepare(qq{
    SELECT name, description, price
    FROM products WHERE id = '$id'
    });
    $sth->execute;
    ($name, $description, $price) = $sth->fetchrow_array();
    $sth->finish;


    To disconnect from the database when you're done:-

    $dbh->disconnect;


    Hmmm...that makes it sound simple. If you need to learn SQL, go here:-
    http://www.sqlcourse.com/

    Good luck,

    Jonathan






    -------------------------------------------
    Count downloads from your site for free!
    http://www.downloadcounter.com/
    Oh yeah, I run a web hosting thing now too.
    http://www.incrahost.com/

  • Shawn CarterShawn Carter Member Posts: 0

    __ < http://forcoder.org /> free video tutorials and ebooks about || Objective-C, Ruby, Python, Delphi, Visual Basic, Swift, Assembly, PL/SQL, Scratch, R, Java, C++, JavaScript, Go, PHP, C, Visual Basic .NET, MATLAB, Perl, C# Julia, ML, Lisp, Crystal, Scala, Alice, COBOL, SAS, Awk, Hack, Transact-SQL, VBScript, Scheme, LabVIEW, Fortran, F#, Rust, Ada, Dart, Logo, Apex, Prolog, Bash, Erlang, Lua, D, ABAP, FoxPro, Clojure, Kotlin || _____

Sign In or Register to comment.