0

$sql="SELECT * Year FROM sslc" Works Fine but when Condition is given its not working

$sql="SELECT Candidate, Father, Course, Year FROM sslc where Candidate LIKE '$Candidate' OR Father LIKE '$Father'";

2nd Code is working in localhost but when uploaded to server it says no data found

1 Answers1

0

While using LIKE operator, you need to make sure you wrap the value with wildcard (%) while querying, e.g.:

$sql="SELECT Candidate, Father, Course, Year FROM sslc where Candidate LIKE '%$Candidate%' OR Father LIKE '%$Father%'";
Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102