0

How do I execute the following code in wordpress

Set time_zone = '+07:00';
SELECT current_date

I tried the following but I didn't get any result.

$sql = 'Set time_zone = '+07:00';
        SELECT current_date'; 
$wpdb->get_var($sql); 

I run the query in phpmyadmin and its working but why it doesn't work in wordpress?

1 Answer 1

4

You have to execute the query one by one.

$sql = "Set time_zone = '+07:00'";
$wpdb->get_var($sql); 
$sql = "SELECT current_date"; 
$wpdb->get_var($sql); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.