Here is the query to find the address from a table where it matches to variable $fromCity
,
$fromCity= "324 West Gore Street, Orlando, FL 32806, USA";
$sql = "SELECT * FROM vendor_info WHERE mailing_address LIKE '$fromCity'";
$em = $this->getDoctrine()->getManager();
$stmt = $em->getConnection()->prepare($sql);
$stmt->execute();
$company = $stmt->fetchAll();
dd($company);
In the table vendor_info
the column mailing address
is like
324 WEST GORE STREETORLANDO, FL 32806
I want to get result if any single word is match from mailing_address
column
now the result of dd(company);
is empty array,
kindly help me out to figure out this solution, it is in symfony,
2
Answers
Maybe like this:
Result:
@mscdeveloper’s answer is basicly correct – but as you use doctrine you should also use prepared statements to be safe(r) from sql injections.