How can I avoid duplicate primary keys in SQL import?
How can I avoid duplicate primary keys in SQL import?
How can I avoid duplicate primary keys in SQL import?
If you can answer ‘yes’ to the questions in Emetrop’s comment, then try: $sql = $wpdb->get_results(‘SELECT * from table1 WHERE id = $bransId’);
I solve it. public function insertionRow($id){ global $wpdb; $wpdb->query(“INSERT INTO wp_choix_attributs_liste (att_id) VALUES (“.$id.”);”); } In my html with the checkbox. if(isset($_POST[‘sub’])) { foreach ($_POST[‘choixP’] as $id) { self::insertionRow($id); } }
I can’t simulate this on a clean install of WordPress. So probably there is some extra filtering of XSS/Injection prevention happening on the server side. You should probably check that out first.
Thanks Milo for the answer! This block of code selects posts that have two categories at the same time. ( ( SELECT COUNT(1) FROM wp_term_relationships WHERE term_taxonomy_id IN (35,33) AND object_id = wp_posts.ID ) = 2 ) Where 35,33 are categories IDs and 2 – number of categories.
A blank page (‘white screen of death’) is usually caused by a fatal error in the PHP code. Since you said that you updated your theme (although it is not clear whether you personally updated the code, or if the theme was updated by the theme developer), then the problem is most likely in the … Read more
Apparently the right way to do this is to get the suffix returned by your custom page that normally displays the table and use it to hook into the page load before any admin content is rendered. add_action(‘admin_menu’, function() { $page_hook_suffix = add_submenu_page( # or related function … function() { # content of table page … Read more
Duplicate WP Migration affecting site on separate domain?
If you just want the ID of the requested post within the template, get_queried_object_id() will give you that. If you want to modify the main query SQL before it’s executed, there are a number of filters that let you directly modify the SQL.
You should gotten return from SQL first. And then print results. Use $wpdb class for SQL queries. If you wanna use native SQL queries something like this might helps you $result = mysql_query(“SELECT * FROM table”); $result_array = mysql_fetch_array($result, MYSQL_ASSOC); But it`s very bad idea. Use $wpdb with preparing.