No need to use []… just use simple single quotations (also no quotations does the job):
$sql ="
SELECT
...
WHERE wp_users.`ID` = '$userID'";
OR
$sql ="
SELECT
...
WHERE wp_users.`ID` = $userID";
Related Posts:
- Undefined function mysql_connect()
- MySQL column count doesn’t match value count at row 1 [closed]
- Undefined function mysql_connect()
- Fatal error: Call to undefined function mysql_connect()
- Fatal error: Call to undefined function mysql_connect()
- Deprecated: mysql_connect()
- MySQL “Or” Condition
- the_date() not working
- How to return number of found rows from SELECT query
- dbDelta support for FOREIGN KEY
- Transaction when using WP functions rather than vanilla SQL?
- Can i use php sql functions instead of $wpdb?
- is it possible to run some php code within a wordpress page?
- How to correctly submit a search form and display the result in an independent page
- Query both first_name and last_name from wp_usermeta at the same time
- Check if post of title already exists
- $wpdb->delete column values IN ARRAY()?
- How to validate WordPress generated password in DB using PHP?
- How to get the list of WooCommerce product image of a certain category from database?
- How to use update and delete query in wordpress
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- Custom query to get post names beginning with a digit
- How to make WordPress plugin check for database changes and then do something?
- Custom SQL query to get List of posts with featured image url
- How To Make Connection To WordPress Data Base In A Plugin?
- How to add query vars with paginated URLs?
- Changing user_nicename
- Does WordPress cache get_user_meta() results?
- WordPress will not operate correctly
- How to Join two tables from separate databases within WordPress
- tag search using WP_Query
- simple wordpress ajax plugin not working when not logged in
- Delete post revisions on post publish
- Jquery ajax to custom php file: returning blank data
- Add value to usermeta without removing previous values?
- Using Echo in ShortCode – Stuck
- Problems migrating WordPress to localhost
- MySQL query performed 4 times inside loop
- Show only one post for each author ( Page loads too slow )
- error importing localhost export file to server
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- How to sort results from a custom database table
- Install will not load: PHP does not have MYSQL installed
- Update some database fields when post is saved
- How can I call a row of user specific data from a custom table added to the WP Database
- Insert post without actions/hooks
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- How to merge local and live databases?
- How to track a users progress through pages by inserting data into WordPress Database?
- the_author_meta not working
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Modern Tribe Calendar wp-query with meta query not working at all
- Passed variable gets undefined variable error on insert on next page
- directorypress theme error mysql_error() [closed]
- How to set up an auto delete post?
- WordPress upload images not displaying
- MySQL queries in WordPress
- two wordpress sites, two themes, one database, same content
- how to check for wordpress Query errors
- Insert double entry in DB
- How to connect database table to each registered wordpress user.
- retrieve wordpress post-meta using php not wordpress functions
- Splash pages on a high traffic site
- Using the same shortcode to show any table from the database
- Splitting One Big WordPress Site into Multiple Small Sites
- Let users register weight each day and save it in DB
- MySQL database migration to WordPress
- Cannot Upload Custom Header Image into WordPress Dashboard
- Custom query_posts() parameter
- MySQL update text field with ‘
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- Query Concatenation
- Predefine Magazine Style Layouts
- I am unable to fetch json data from wp_db
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- Your PHP installation appears to be missing the MySQL … After deleting and restarting from cpanel
- How to send push notification in android using php? [closed]
- Display total count of products in orders of a specific order status
- How to set variable to specific field when querying
- How to get a database field value from a WordPress table? [closed]
- Getting invalid user ID error when creating a new user with wp_insert_user
- Execute multiple PHP Snippets causes error?
- Custom form that stores data in mysql database
- Error resetting database index using ALTER TABLE in $wpdb->query
- what to do after instlling cyberpanel on VPS
- Putting form result in my database
- How can I update a value of a field depending on outside source?
- running an existing WordPress site from Visual Studio Code?
- Can’t insert into a database wordpress
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax [closed]
- Global update of records after import WP All Import Pro
- Updates applied to staging WordPress site affecting production even with different databases
- Help with creating commenting system using PHP, jQuery and AJAX
- WP-CLI PHP Deprecated Warning
- WordPress install on new server not recognising MariaDB version
- How to properly prepare a column name if passed to a stored procedure?
- How to return count number from a wordpress database
- Trying to GET data with ajax from database and show in fullcalendar