my code is logging people's ip in the mysql data.table.So, the problem is it's working on my localhost but when I transfer my files to my ubuntu server it's not working. There is no error or something on my website. But the data is not covering in my data.table above the server. here is the iplog.php
<?php
include 'configserver.php';
$url=$_SERVER['REQUEST_URI'];
$ip=$_SERVER['REMOTE_ADDR'];
$host=$_SERVER['SERVER_NAME'];
$log= $db->prepare("INSERT INTO iplog (ip,url,hostname) VALUES (:ip,:url,:hostname)");
$log->bindParam(':ip', $ip);
$log->bindParam(':url', $url);
$log->bindParam(':hostname', $host);
$log->execute();
?>
Did you try to add the following code just after $log->execute() to fetch the last PDOStatement error?
echo "\nPDOStatement::errorInfo():\n";
$arr = $log->errorInfo();
print_r($arr);
Check your PDO drivers settings with phpinfo(); and make sure there is a driver enabled for your database engine.
Also, make sure that PDO autocommit is enabled on your remote server.
I solved the problem. I created another table in my server's MySQL and changed the data way it solved. Thank you for all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.