I am trying to use a php string as a not in argument within a sql statement. The php string I wanted to use looks like the following:
$excludedValues = "test,these,origin"
I would like to use that string as an argument in the following sql:
$conn = $this->getEntityManager()
->getConnection();
$sql = "SELECT u.name FROM user u WHERE u.name NOT IN(:names)";
$stmt = $conn->prepare($sql);
$stmt->execute(array('names' => $excludedValues));
return $stmt->fetchAll();
The excludedValues are being ignored.. what am I doing wrong here?
Information: It is not an array, and even with using an array and implode, I couldn't get it to work.
Regards.