Guest $$$-scorpion-$$$ Posted July 3, 2006 Share Posted July 3, 2006 Hi Guys. Need help debugging my first PHP script to log a user ip address browser etcCode Below For logger.php[code]<?include 'config.php' ;function LogIp(){$ip = $_SERVER['REMOTE_ADDR'];$date = date("l dS of F Y h:i:s A"; $browser = $_SERVER['HTTP_USER_AGENT'];$referer = $_SERVER['HTTP_REFERER'];$insert = "INSERT into logger (ip, date, browser, referer) VALUES ('$ip' , '$browser' , '$referer')"; $logquerry = mysqli_query($connect, $insert); }LogIp()?> [/code]and config.php[code]<?$host = localhost ;$user = root ; $pass = password ;$db = databaste ;$connect = mysqli_connect('$host' , '$user' , '$pass' , '$db') ;?>[/code]thanks in advance for your helpBTW im only 14 so sorry for any spelling mistakes Link to comment https://forums.phpfreaks.com/topic/13528-php-debug-help/ Share on other sites More sharing options...
Houdini Posted July 3, 2006 Share Posted July 3, 2006 Change the config.php to this[code]<?$host = "localhost" ;$user = "root" ; $pass = "password" ;$db = "databaste" ;$connect = mysqli_connect($host , $user , $pass , $db) ;?>[/code] And you might want to add some error checking here[code]$logquerry = mysqli_query($connect, $insert);[/code]change to this[code]$logquerry = mysqli_query($connect, $insert) or die("Could not execute the query! MySQL said: ".mysql_error());[/code] Link to comment https://forums.phpfreaks.com/topic/13528-php-debug-help/#findComment-52409 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.