I have a search field that is numeric and can contain up to 4 digits. When I query using LIKE I'm getting all numbers that contain the queried integer. How can I constrain to just the desired number? var2 is the number
Code:
$var1_Recordset2 = addslashes($GET['name']);
$var2_Recordset2 = addslashes($GET['class']);
mysql_select_db($database_mt_connect, $mt_connect);
$query_Recordset2 = ("SELECT * FROM mt_students WHERE sname like '%".$var1_Recordset2."%' and class like '%".$var2_Recordset2."%'");
$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
$Recordset2 = mysql_query($query_limit_Recordset2, $mt_connect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
Thanks