Ok, like this?
Code:
// check if mod is already installed
//$db->reporterror = 0;
$lgvtbl = $db->query_first("SELECT COUNT(id) as lgv FROM ". TABLE_PREFIX ." lgv");
if (!$lgvtbl['cnt']){
// create the table
$db->query_write("CREATE TABLE ". TABLE_PREFIX ." lgv (
id smallint(5) unsigned NOT NULL auto_increment,
ipaddress VARCHAR(25) NOT NULL default '0.0.0.0',
firstaccess INT UNSIGNED NOT NULL DEFAULT '0',
views INT(4) NOT NULL DEFAULT '0',
lastactivity INT UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (id),
KEY indexs (ipaddress,views,lastactivity)
) TYPE=MyISAM
");
// insert the first record
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "lgv SET
ipaddress = '123.456.789.012',
firstaccess = ". TIMENOW .",
views = 1,
lastactivity = ". TIMENOW ."
");
echo "<font size=\"1\">Added mySQL Tables</font><br /><br />";
} else {
echo "mySQL table already exists.";
}