mcfc4heatons Posted September 30, 2019 Share Posted September 30, 2019 Hi - I’m getting an error all of a sudden, can somebody point me to the issue please? Error: 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 ‘-1%’’ LIMIT 18446744073709551615’ at line 1 // begin Recordset $suggestParam__colours = '-1'; if (isset($_GET['suggest1_choice'])) { $suggestParam__colours = $_GET['suggest1_choice']; } $query_colours = sprintf("SELECT colour_name FROM colours WHERE colour_name LIKE '%s'", GetSQLValueString($suggestParam__colours . "%", "text")); $colours = $autocomplete->SelectLimit($query_colours) or die($autocomplete->ErrorMsg()); $totalRows_colours = $colours->RecordCount(); // end Recordset Quote Link to comment https://forums.phpfreaks.com/topic/309304-sql-syntax-error-at-line-1/ Share on other sites More sharing options...
ginerjm Posted October 1, 2019 Share Posted October 1, 2019 (edited) Don't understand what you are building with that call to sprintf. Even looking at your query statement without using sprintf (you know that you don't have to write a statement using sprintf?) the statement doesn't make sense. What are the two functions you are using doing for you? What is autocomplete? SelectLiimit? Perhaps you could echo out the final sql statement before you run it and show us what your query looks like so we can see what the error message is telling us? Edited October 1, 2019 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/309304-sql-syntax-error-at-line-1/#findComment-1570138 Share on other sites More sharing options...
requinix Posted October 1, 2019 Share Posted October 1, 2019 GetSQLValueString, one aspect of the scourge that Dreamweaver has wrought on the PHP development world, quotes strings for you. Quote Link to comment https://forums.phpfreaks.com/topic/309304-sql-syntax-error-at-line-1/#findComment-1570139 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.