Vincent Vincent - 1 month ago 5
PHP Question

SQL query doesn't show expected values

I'm trying to retrieve information from my SQL database, when I enter my query in phpmyadmin, it comes out correct but when I try to do it with a php query, the output differs:


  • sql query in phpmyadmin:

    SELECT * FROM wp_postmeta WHERE meta_key = 'ID'

  • what I have in php:

    $stmt = $dbHandle->query("SELECT '*' FROM wp_postmeta WHERE meta_key = 'ID' ");

    $row = $stmt->fetch();
    var_dump($row);



Anyone ideas?

Answer
$stmt = $dbHandle->query("SELECT * FROM `wp_postmeta` WHERE `meta_key`='ID';");
Comments