Jump to content

SQL Syntax Error At Line 1


mcfc4heatons
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

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 by ginerjm
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.