0

Why isn't this working? I've viewed the past posts on the subject and nothing worked for me.

$sql_strongsdef_ses = "SELECT id, strongs, etym_strongs FROM ".$tablename." WHERE etym_strongs LIKE ?";
$params = array("'%".$getSearchEtymStrongs."%'");
$result_strongsdef_ses = $conn->prepare($sql_strongsdef_ses);
$result_strongsdef_ses->execute($params);

echo "<span style=\"color: red;\">".$sql_strongsdef_ses."</span><br /><br />\n";

//while ($row_ses = $result_strongsdef_ses->fetch()){
while($row_ses = $result_strongsdef_ses->fetch(PDO::FETCH_ASSOC)){
    $id_ses = $row_ses['id'];
    $strongs_ses = $row_ses['strongs'];
    $etymstrongs_ses = $row_ses['etym_strongs'];
}

var_dump($strongs_ses);

I get the error:

Notice: Undefined variable: strongs_ses in \edit.php on line 52

showdev
  • 28,454
  • 37
  • 55
  • 73
  • 1
    Possible duplicate of [Using LIKE in bindParam for a MySQL PDO Query](https://stackoverflow.com/questions/11068230/using-like-in-bindparam-for-a-mysql-pdo-query). – showdev Nov 27 '19 at 02:39
  • If `$strongs_ses` is undefined, it's likely that the query didn't return any rows. Try removing the single quotes from `array("'%".$getSearchEtymStrongs."%'")`. – showdev Nov 27 '19 at 02:42

0 Answers0