You have an error in your SQL syntax

hello who those read this :D
what is the wrong in this code?

<?
$from=date("F d, Y",strtotime($from)); 
$to=date("F d, Y",strtotime($to)); 
$myquery=mysql_query('SELECT * FROM tbledited WHERE fldempid LIKE %$search% AND fldcdate BETWEEN $from AND $to ORDER BY ndex LIMIT '.intval($_GET['limit']).', 10',$conn) or die(mysql_error());
?>

the error is:
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 ‘%$search% AND fldcdate BETWEEN $from AND $to ORDER BY ndex LIMIT 0, 10’ at line 1

tnx

missing quotes:
… LIKE “%’.mysql_escape_string($search).’%” AND …

ok got it… tnx

Sponsor our Newsletter | Privacy Policy | Terms of Service