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 Quote 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] Quote Link to comment https://forums.phpfreaks.com/topic/13528-php-debug-help/#findComment-52409 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.