In SQL statement use placeholders instead of variable: %s (string) or %d (number).
The second argument of prepare() is array of variables to substitute into the placeholders.
$skill_select = $wpdb->get_results(
$wpdb->prepare("
SELECT skill_name, char_id, um_id, c.class_id
FROM `wp_ml_skill_class` sc
JOIN `wp_ml_skill` s ON (s.skill_id = sc.skill_id)
JOIN `wp_ml_character` c
WHERE c.class_id = %d AND c.char_id = %d",
[$convert_class_id, $convert_char_id]));
Related Posts:
- the_date() not working
- Delete post revisions on post publish
- How to sort results from a custom database table
- WP database error for comments_popup_link()
- Why is variable not working on custom sql query using wpdb?
- Create WP_Query to search for posts by their categories or their parent/child categories
- mysql query from wordpress page using custom table
- Long running queries
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- WordPress SQL injection
- Which is the correct way to conditionally enqueue a CSS file?
- Parse error: syntax error, unexpected ‘}’ [closed]
- mySQL queries are executed twice on wordpress website
- WordPress Custom Query: Combining Two Functions
- SQL error with custom query
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- WordPress Bad Request Error 400
- How can i limit the number of posts to the most recent 6 in my query?
- Query doesn’t display text data with apostrophes
- How to do a MySql query in WordPress?
- How can I display a query in a page?
- Include a custom field in mysql query
- Getting invalid user ID error when creating a new user with wp_insert_user
- Execute multiple PHP Snippets causes error?
- taxonomy pages returning “NULL” when running default WordPress function ‘get_queried_object()’
- How can I save unique user data on my site? [closed]
- Error on wp_default_style After upgrade to php 7
- Update results, Before deleting the related category [closed]
- Sum the total amount of a specific product purchased per user and display in table
- Ordering users by custom user meta
- Increase offset while looping
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Hacked WordPress website /Homepage redirect [closed]
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Replacing mysql_escape_string in a custom plugin when moving to PHP7
- How to pre populate a form field with a link of a current user’s author profile?
- Weird 404 URL Problem – domain name being placed at end of urls
- wp query foreach deleting record returning only first or last item
- Refresh table data with Ajax
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script
- database sent to a JSON file
- inserting a post from an extern php file but post content doesn’t show on wp site
- Query if audio attachment AND/OR custom field
- Database query works fine outside WordPress
- $wpdb->wp_users returning empty value for
- Large Woocommerce Site (83,000 items), What Can I Do? [closed]
- $wpdb->insert() does not Insert record in a table
- Getting error when using wp_insert_post()
- Error: options page not found
- Using custom tables for old posts
- register_taxonomy() take much queries
- Help with a $wpdb MySQL Query
- Headers already sent in Pluggable.php / homepage and wp-login error
- Not connecting to database in file with multiple MySQL connections
- Way to bulk make all my tags lowercase?
- $Wpdb post meta query is not working with mutliple meta keys and values? [closed]
- “Undefined index” error when saving empty array with checkboxes
- How i can obtain all the post meta for a specific post as an array?
- multiple where condition in result query
- Odd / Even posts add class minus first post
- Grouping posts by a custom meta value
- unable to use ‘new WP_Query’ in AJAX call
- Multiple meta_key in one global $wpdb;
- Custom array from a query only write the last row of the query
- WordPress member notification
- Parse error: syntax error, unexpected ‘}’ on get_the_author_meta [closed]
- Can’t Query Custom Table Using $wpdb Method
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- WordPress Block developer from exporting Database via PHP
- How to list commenters and days since last commented
- How to add div blocks after certain set of post
- Preg_Match(): compilation failed unknown property name
- $wpdb returns duplicate posts
- How to overwrite orderby with add_query_var
- Can’t update multiple rows with $wpdb query
- Update postmeta after theme switch
- Warning: Illegal string offset on theme options page [closed]
- Mixing variables into an array when inserting values
- Location of core code for database connection and get_header
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- php include not working in custom page
- How do I display offsite database info on my wordpress site?
- customize wordpress database error page
- Creating Database Table vs. Adding MetaData to Post & User
- Make a database query using WordPress
- PHP if statement works in template files, but not header
- Force Users To Relogin
- working with term_relationships table
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- WordPress Custom SQL Table with UserID Filter for results
- WordPress query undefined offset in loop
- Most commented posts by time period (last 12h, last 24h and etc)
- Can I make get_users() query global?
- Use $wpdb or other PHP script method to find/replace in WP database
- email alert for product availability
- How can I add a new row in a separate database when someone registers via WordPress?