1

I'm having issues with working with mysql's FIND_IN_SET and pdo. This is my code:

$statement = $conn->prepare("SELECT * FROM `artistInfo` WHERE FIND_IN_SET(':array', artistServices)");
$statement->execute(array(':array' => '2'));
while($row = $statement->fetch()){
   echo $row['id'];
   echo "<br />";
}

This doesn't produce any results. Am I doing something wrong? Thanks!

user939951
  • 77
  • 5

1 Answers1

0
$statement = $conn->prepare("SELECT * FROM `artistInfo` WHERE FIND_IN_SET(':array', artistServices)");
$statement->execute(array(:array => '2'));
while($row = $statement->fetch()){
   echo $row['id'];
   echo "<br />";
}

The single quotes surrounding :array is why I wasn't getting any results

user939951
  • 77
  • 5