Vincent Vincent - 1 year ago 97
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?

Answer Source
$stmt = $dbHandle->query("SELECT * FROM `wp_postmeta` WHERE `meta_key`='ID';");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download