Help posting values to DB on submit using $wpdb->query

$wpdb has an insert method, so you can try the following: $table=”wp_email_subscribers”; $data = array( ‘first_name’ => $firstname, ‘last_name’ => $lastname, ’email’=> $email , ‘gdpr_consent’=>$gdprconsent ); $format = array(‘%s’,’%s’, ‘%s’, ‘%s’); $wpdb->insert($table,$data,$format); var_dump($wpdb->insert_id);

Where is the HTML-handler part in the wpdb class?

wpdb->query() is just running the query. It doesn’t do anything special. And strip_invalid_text_from_query() based on the inline documentation is just stripping invalid characters in the query. And, for your information, something like line-breaks doesn’t break the database. The database can accept any string data. You just have to make sure it correctly escaped when the … Read more

Sql query triggered twice

Try Applying These Changes Add this conditional before the // first check if data exists with select query: // Do nothing else if the search term is empty. if ( empty( $search_term ) ) { return $where; } Update: You may also want to check if it’s the main query and if not, exit the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)