armeen Posted January 6, 2013 Share Posted January 6, 2013 (edited) 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') Edited January 6, 2013 by armeen Quote 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 (edited) 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 Edited January 6, 2013 by Barand Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.