armeen Posted January 6, 2013 Share Posted January 6, 2013 hi there i have installed a script and now when i want to accec my site it coms with the next error. what should i do to fix this issue ? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'\', \'195.240.24.221\', \'index.php\', \'GET\', \'20130106052206\', \'0\', \'M' at line 1 Query ::INSERT INTO tracker (id, ip, page, viewType, happened, userID, userAgent, protocol) VALUES ('', '195.240.24.221', 'index.php', 'GET', '20130106052206', '0', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0', 'HTTP/1.0') Link to comment https://forums.phpfreaks.com/topic/272755-after-installation-of-a-script-mysql-error/ Share on other sites More sharing options...
Barand Posted January 6, 2013 Share Posted January 6, 2013 Let me guess. To save having to escape all the variables individually you created the SQL query and escaped the whole query. try $sql = sprintf("INSERT INTO tracker (ip, page, viewType, happened, userID, userAgent, protocol) VALUES ('%s', '%s', '%s', '%s', %d, '%s', '%s')", mysqli_real_escape_string($connection, $ip), mysqli_real_escape_string($connection, $page), mysqli_real_escape_string($connection, $viewType), mysqli_real_escape_string($connection, $happened), intval($userID), mysqli_real_escape_string($connection, $userAgent), mysqli_real_escape_string($connection, $protocol) ); Note : id is excluded, not passed a blank value Link to comment https://forums.phpfreaks.com/topic/272755-after-installation-of-a-script-mysql-error/#findComment-1403584 Share on other sites More sharing options...
armeen Posted January 6, 2013 Author Share Posted January 6, 2013 Let me guess. To save having to escape all the variables individually you created the SQL query and escaped the whole query. i yust have downloaded that script Link to comment https://forums.phpfreaks.com/topic/272755-after-installation-of-a-script-mysql-error/#findComment-1403586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.