View Single Post

Member Since: Oct 07, 2005
Location: Seattle
Posts: 346
djames42 has a spectacular aura about
Mac Specs: MBP CD 1.83/2ghz/7200 100g + Mini 2ghz C2D 2gb + Mini 1.42ghz G4 + PM 7200/120 + Newton OMP

djames42 is offline
For what it's worth, here's a very simple snippet of code I just hacked together. This takes a few parameters pushed to it by way of wget (which, if you're not familiar with, is a way of emulating a web browser in code to pass a URL to a server and retrieve any html pushed from that server). It takes the passed parameters and loads them into a local mysql database. You should be able to use this to see a very simple way of putting data in to your database. Getting it out is slightly more complicated, but not much...


$date=date('Y-m-d H:i:s');

$db_conn = mysql_connect('localhost', 'username', 'password');
if (!$db_conn) {
    die('Could not connect: ' . mysql_error());

$db_selected = mysql_select_db('database_name', $db_conn);
if (!$db_selected) {
    die ('Can\'t use database_name : ' . mysql_error());

$insert=sprintf("insert into session_history values('%s','%s',%d,%d)",
        $sessioncnt, $totalsessions);



The way this script is called is by running the following command:

wget -q --delete-after "http://web_url/~user/path/scrpt.php?server=${hostname}&sessioncnt=${usedprocs}&totalsessions=${maxprocs}"
QUOTE Thanks