I have 4 buttons and when clicking each one it runs different sql query.
My code is here:

<?php

if(isset($_POST['submit1'])){
    global $wpdb; 
    $wpdb->update( $wpdb->options, array("option_value" => "000"), array("option_name" => "theme-bg"), array("%s"), array("%s") );
}elseif(isset($_POST['submit2'])){
    global $wpdb; 
    $wpdb->update( $wpdb->options, array("option_value" => "..."), array("option_name" => "widget_son_eklenenler2"), array("%s"), array("%s") );
}elseif(isset($_POST['submit3'])){
   include 'theme2.php';
}elseif(isset($_POST['submit4'])){
      include 'theme3.php';
}
?>

When I clicked second, third or the other buttons, it shows no warning but whenever I click the first button it gives a php warning like this

Thank you for reading it.

Read more here: Php Illegal offset type error when running sql query


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: