I think the line should be:
$selected_candidate = $_POST['candidat'];
=>
$selected_candidate = $_POST['selectCandidate']
Btw. You are using “prepare” in the wrong way. You are not protecting yourself from sql injections, use it like this:
$wpdb->query( $wpdb->prepare("UPDATE pp_candidates SET candidate_approved = 1 WHERE candidate_ID = %d", $selected_candidate));
Related Posts:
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- How to return number of found rows from SELECT query
- Can i use php sql functions instead of $wpdb?
- $wpdb->delete column values IN ARRAY()?
- Custom query to get post names beginning with a digit
- Add value to usermeta without removing previous values?
- WordPress get pagination on wpdb get_results
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- Why is variable not working on custom sql query using wpdb?
- Show MySQL errors that occur when I excute $wpdb->insert()
- database interactions using OOP
- Remove one value in dismissed_wp_pointers?
- Can’t get wp_insert_post to work
- Accessing data from a non-WP database/table within a page content
- WSoD being caused by this piece of code
- I want to select the from values from database in WordPress? [closed]
- How to check if a meta value has already been assigned to any user?
- Update results, Before deleting the related category [closed]
- Weird 404 URL Problem – domain name being placed at end of urls
- wp query foreach deleting record returning only first or last item
- Database query works fine outside WordPress
- $wpdb->insert() does not Insert record in a table
- Help with a $wpdb MySQL Query
- Custom array from a query only write the last row of the query
- $wpdb returns duplicate posts
- Mixing variables into an array when inserting values
- Use $wpdb or other PHP script method to find/replace in WP database
- How can I add a new row in a separate database when someone registers via WordPress?
- I can’t update my data through $wpdb
- Output: “Array”
- How to use mysql LIKE with wpdb?
- How do I prepare strings for insertions as values into a MySQL table?
- How to use AJAX in WordPress in MYSQL query?
- form $_post action value gets truncated after it passes through two forms
- Why won’t this wpdb get_results query return results?
- WPDB secure custom form
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- populate select options from extra mysql table data
- Query the links Database
- MySQL Query Returns Array () In Shortcode
- Passing in MySQL prepare statement parameter separately throwing error
- Convert a column of a table containing an Array as response in HTML
- Database SQL query error
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Conditional formatting on data fetched from MYSQL
- What is the correct way to search 3 custom fields only in WordPress?
- Using wpdb to connect to a different database is not working
- Rewrite SQL query as a prepared statement and use in foreach loop
- Advanced WordPress SQL Query
- Add two or multiple functions in WordPress Post or Page
- MySQL query in WordPress with AJAX
- Passed variable gets undefined variable error on insert on next page
- MySQL queries in WordPress
- Using the same shortcode to show any table from the database
- MySQL database migration to WordPress
- Error resetting database index using ALTER TABLE in $wpdb->query
- Putting form result in my database
- How can I update a value of a field depending on outside source?
- How to properly prepare a column name if passed to a stored procedure?
- pass html code to worpdress
- pagination broken – clicking next displays “page not found”
- Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin
- $wpdb is queried but results don’t show
- How do I custom code the start page?
- making php value numeric
- Display movies that apear this day next
- Kohana Frontend, WordPress Backend
- WordPress SQL JOIN query
- is_user_logged_in returning nothing on custom page
- Customize field names in backend profile edit page through function.php [duplicate]
- Editor capabilities – admin_init
- Most viewed posts in WordPress
- How to create Loop code for Menu using WordPress?
- Fetching review value using wpdb class
- how to add datas in taxonomy to post with wp_insert_post
- WordPress Custom Query: Combining Two Functions
- Site DOES NOT LOAD after 3.1 update
- WP insert post Redirect after function has executed
- Removal of all posts content in bulk, keeping the posts itself
- SQL error with custom query
- Create condition for Author bio Social Links
- How to WP_Query posts order by parent title?
- WordPress get last inserted user id
- Modify WooCommerce used to get all orders in dashboard
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- Change permalink structure specific category
- Add posts to custom table in database instead of wp_posts
- Array data not saving to specified sections. How to make seting independantly?
- WP_REST_Response – How to return Gzip answer and add Content-encoding header?
- Customizer control save then return to default
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Create Columns with Custom Walker and CSS Classes
- How to store checkbox data for individual users?
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- WP-Bakery – Add custom colors to buttons with template colors
- WordPress low speed after migrating to new host
- Get mysql data for Quick Edit panel