Today, I have a issue in $wpdb.
I used
$result = $wpdb->get_var(
$wpdb->prepare(
"SELECT DATE_FORMAT(report_date, '%d-%m-%Y') FROM table WHERE report_id = %d",
$report_id
)
);
The above code not works because of %d in DATE_FORMAT. How i solved this issue in wordpress
From the Codex page for the WPDB class:
Having a look at PHP’s documentation for
sprintf()
:So you can use
for your purposes.