Vincent Vincent - 5 months ago 43
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();

Anyone ideas?

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