$wpdb Query Result not coming but in phpmyadmin it works [closed]

Here is my query, when i run this in PHP file its returns NULL but same query in Phpmyadmin return row.

Even I tried with $wpdb->get_row() and $wpdb->get_col() but the result is same for all.

include 'wp-config.php';
global $wpdb;
$result = $wpdb->get_results("SELECT * FROM wp_order_transaction WHERE order_id=1431");
var_dump($result);

can any one tell me where is my mistake.
Thanks in advance!

1 Answer
1

You need to include the “wp-load.php” file at the top of the code

Leave a Comment