Quick Tip – How to Connect to MySQL using Perl

Posted July 5th, 2010 by Bryan in Tutorials

This is a Quick Tip on how to connect to a MySQL database using Perl. Even though many other languages are sneaking their way onto Perl’s turf. There is still a great demand for Perl on the web, so don’t forget one of it’s primary uses. Here’s the code:

#!/usr/bin/perl
use DBI;

$database = “DATABASENAME”;
$hostname = “db.DOMAIN”;
$port = “3306?;
$username = “USERNAME”;
$password = ‘PASSWORD’;

$dsn = “DBI:mysql:database=$database;host=$hostname;port=$port”;

$dbh = DBI->connect($dsn, $username, $password) or die(”Could not connect!”);

$dbh->disconnect;

First we have to tell perl to use the DBI module. Define our variables. Then define the database information. Finally we’re able to connect to our database. This could be done in one line, but you’ll find that most people prefer to connect their scripts this way for clarity. That’s all. Thanks for reading

Quick Tip – How to connect to MySQL with PHP

Posted July 5th, 2010 by Bryan in Tutorials

This is a Quick Tip on how to connect to MySQL with PHP. We have all done it from time to time, but sometimes we forget just how to connect to those pesky MySQL databases directly using PHP. So here’s how it’s done:
<?php
function open( ){$db = mysql_connect( ‘localhost’, ‘root’, ‘password’ );
} ?>

Here we have custom a function “open”. Followed by the mysql_connect function which we will supply the url, username, and password. It’s pretty simple to do in PHP. Thanks for reading

Setting up a Local Web Server with Apache Friends XAMP

Posted July 5th, 2010 by Bryan in Tutorials

More times then not I have needed the use of a webserver to test various portions or web design that I’m working on for a client. In years past, this was not the easiest thing to do. You would first have to download your web server, and configure it for your system. Then you would have to track down, download, configure, and install various modules, extensions, and runtimes like Perl or PHP. In the end it was always a big hassle, and you were rarely able to install identical loads on two different machines.

Continue reading

  •  

    operating-pressure-demonstration img_5646 d30_4174 Over look butterflies d30_4167 judy-lighting-off-the-ground-fire-pit-while-i-watch judy the-first-pit img_5622