I don't get OUTPUT
Posted: Sat Dec 14, 2002 2:59 pm
Hi Guys,
I have corrected some of the code.
But I don't get any output.
The code did not output anything to the screen.
Please can you help me.
Here are the syntax of mysql code,
#####################################
#CREATE TABLE tracker (
# id int(5) NOT NULL auto_increment,
# browser varchar(50) NOT NULL default '',
# count int(10) NOT NULL default '0',
# date date NOT NULL default '0000-00-00',
# host varchar(50) NOT NULL default '',
# PRIMARY KEY (id)
#) TYPE=MyISAM;
#####################################
Thanks in advanced for your support.
Jam
I have corrected some of the code.
But I don't get any output.
The code did not output anything to the screen.
Please can you help me.
Here are the syntax of mysql code,
#####################################
#CREATE TABLE tracker (
# id int(5) NOT NULL auto_increment,
# browser varchar(50) NOT NULL default '',
# count int(10) NOT NULL default '0',
# date date NOT NULL default '0000-00-00',
# host varchar(50) NOT NULL default '',
# PRIMARY KEY (id)
#) TYPE=MyISAM;
#####################################
Thanks in advanced for your support.
Jam
Code: Select all
<?php
$connection = mysql_connect("localhost", "user", "pass") or die("no go bro can not connect");
$database = "tracker";
$table="tracker"; // this is a tablename
$db = mysql_select_db("$database") or die ("y0 no database");
$browser = $HTTP_USER_AGENT;
$date1 = date("F jS Y, h:iA");
$result = mysql_query("SELECT host FROM $table where host LIKE '%$REMOTE_ADDR%'");
if (mysql_num_rows ($result) == 1)
{
mysql_query ("UPDATE $table SET date='$date1' WHERE host = '$REMOTE_ADDR'");
mysql_query ("UPDATE $table SET count=count+1 WHERE host = '$REMOTE_ADDR'");
mysql_close($connection);
}
else {
if ($REMOTE_HOST == "") {
$host = $REMOTE_ADDR;
} else {
$host = $REMOTE_HOST;
}
if ( empty( $HTTP_REFERER ) or '' == $HTTP_REFERER ) {
$HTTP_REFERER = 'No Referer';
}
mysql_query ("INSERT INTO $table (browser, date, host, referer) VALUES ('$browser','$date1','$host','$HTTP_REFERER' )");
mysql_close($connection);
}
?>