Changed to BIGINT(255), still no luck.
So i tried something different:
Code: Select all
<?php
include("dbaccess.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM visit_history ORDER BY id DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < 1) {
$nid=mysql_result($result,$i,"id") + 1;
$i++;
}
$ref2=$_GET['ref'];
$invalidChars=array("/","\\","\"",";");
$ref=str_replace($invalidChars,"",$ref2);
$ip=$_SERVER['REMOTE_ADDR'];
$datetime = date("Y-n-j, H-i-s, O I");
// I think you might want to quote localhost here
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = ("INSERT INTO `visit_history` ( `id` , `ip` , `datetime` , `ref` ) VALUES ('$nid','$ip','$datetime','$ref')") or die(mysql_error());
// error check the query
mysql_query($query) or die('Error: ' . mysql_error());
mysql_close();
?>
Basically I get the last ID from table and then insert new row with ID + 1.
And now it works
But thank you very much for the help you gave!