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?
- Fatal error: Call to undefined function mysql_connect()
- Why have on every line
- simple wordpress ajax plugin not working when not logged in
- Insert post without actions/hooks
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- Custom Plugin For Converting CSV To MySQL
- Trying to establish connection to External Database
- Can I install/embed WordPress on a ‘single page’?
- $wpdb->update with multiple parameters gives error
- Custom posts in different columns style
- $wpdb->wp_users returning empty value for
- Add data-id attribute to child page links
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Force Users To Relogin
- wpdb Cannot Update column in Database
- Check class_exists before class definition / Doxygen problem
- Extract links from content
- Custom Registration username_exists / email_exists
- WPDB – Read and write value from / to database
- Is it possible to add a custom page to a free WordPress site? [closed]
- How to Fix an Archive.php That Displays All Posts?
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- WP-Bakery – Add custom colors to buttons with template colors
- WordPress low speed after migrating to new host
- call to undefined function mysql_connect
- How to edit content in WordPress and the Polylang – plugin? – with demosite
- Search only for posts with specific metadata?
- Is there a way to have chunks of a page’s content expire?
- Showing the project type in HREF
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Run insert if no entry otherwise run update with ajax
- WordPress upload images not displaying
- Pagination on Custom Loop
- MySQL Engine vs. Charset
- Query Concatenation
- Display total count of products in orders of a specific order status
- inner-wrap div pushing custom table far down on page
- running an existing WordPress site from Visual Studio Code?