paulman888888 Posted June 22, 2008 Share Posted June 22, 2008 <?php require('connect.php'); ?><?php $ipaddress=$_SERVER['REMOTE_ADDR']; $thedate=date("m:d:y"); $thetime=date("H:i:s") mysql_query("INSERT INTO intowar1 (ipaddress, thedate, name, thename) VALUES($ipaddress, $thedate,'" . mysql_real_escape_string($_GET['name']) . "', $thetime)") or die('Theres an error. Please try again.#'); ?> I know its something to do with the quotes, i dont understand them. thankyou Quote Link to comment https://forums.phpfreaks.com/topic/111359-solved-php-mysql-problem-lt-please-help/ Share on other sites More sharing options...
unidox Posted June 22, 2008 Share Posted June 22, 2008 Try this: <?php require('connect.php'); ?><?php $ipaddress=$_SERVER['REMOTE_ADDR']; $thedate=date("m:d:y"); $thetime=date("H:i:s"); mysql_query("INSERT INTO `intowar1` (ipaddress, thedate, name, thename) VALUES ('$ipaddress', '$thedate','" . mysql_real_escape_string($_GET['name']) . "', '$thetime')") or die("Theres an error. Please try again."); ?> Quote Link to comment https://forums.phpfreaks.com/topic/111359-solved-php-mysql-problem-lt-please-help/#findComment-571708 Share on other sites More sharing options...
paulman888888 Posted June 23, 2008 Author Share Posted June 23, 2008 i get this error. Theres an error. Please try again. So what part have i done wrong? thankyou Quote Link to comment https://forums.phpfreaks.com/topic/111359-solved-php-mysql-problem-lt-please-help/#findComment-572363 Share on other sites More sharing options...
ober Posted June 23, 2008 Share Posted June 23, 2008 You need to surround all of those inputs with single quotes... they're all strings. The only time you can leave off the single quotes is if the value is strictly an integer or a float. Also, always use " or die (mysql_error()). That will be much more descriptive. mysql_query("INSERT INTO intowar1 (ipaddress, thedate, name, thename) VALUES('$ipaddress', '$thedate','" . mysql_real_escape_string($_GET['name']) . "', '$thetime')") or die('Theres an error. Please try again.#'); Quote Link to comment https://forums.phpfreaks.com/topic/111359-solved-php-mysql-problem-lt-please-help/#findComment-572368 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.