If you really just want a single row, use $wpdb->get_row($sql)
instead.
But your query looks funny…it looks like you’re trying to get the latest ‘client status’ for the user in which case your query should be:
'SELECT status FROM Clients WHERE UserID = '.$current_user->ID.' ORDER BY ID DESC LIMIT 1'
.
And if you do that, you can then even use $status = $wpdb->get_var($sql);
.
Lastly…did you consider using add_user_meta/get_user_meta instead? There’s a lot of benefits to using the native tables and functions, such as that the records get cleaned up when you delete the user and the likes.
Related Posts:
- Should I use wpdb prepare?
- Is it mandatory to use $wpdb->prefix in custom tables
- Custom Widget function in Plugin not working?
- Adding Widget form fields dynamically
- What is the correct way to build a widget using OOP
- $wpdb->insert_id
- Widget development – Drop down options won’t save
- Calling the widget id of a mult-instance widget from inside the widget?
- Check for success of $wpdb->update() correctly
- Is There A Hook To Process The Content Of The Text Widget?
- WordPress and multithreading
- Add content to widget title in admin area within the widget?
- Has anyone managed to integrate the wp_editor inside a widget?
- $wpdb->insert is changing a value
- Actions or filters fired when data is saved in a custom table
- Retrieving custom fields with $wpdb->get_results
- Help adding image upload functionality to widget
- Using preg_replace to clean widget output HTML
- Edit the output of wp_widget_rss_output()
- Script to remove all inactive widgets?
- Possible to preset a widget’s contents via a plugin script?
- Multiple entries in get_option results? or why is _multiwidget set to 1?
- How to add multiple copies of a widget from “available widgets”
- Install widget on plugin activation
- Really simple query giving error in SQL syntax
- Custom Plugin Database relations
- Using Ajax call in jQuery doesn’t work in widget
- why creating tables using $wpdb is not being executed while installing plugins?
- How to use mysql IN statement with wpdb update method?
- WordPress select dropdown list in widget
- Is there a need to do apply_filter(‘widget_title’, $instance[‘title’]) or any other ‘widget_xxx’ filters?
- Activation hook not creating table
- Dynamic content in a widget
- How to pass custom options from widget form to widget update callback?
- Broken markup when using the_excerpt() in a widget?
- Tips for targeting widget dragable for WP Pointer on widgets.php page
- How to create custom field in worpdress default widgets?
- PHP 7 – Class Method Compatibility Issue
- Widget Admin – Form Submit Event?
- $wpdb -> Batch insert from XML File?
- How to save WP widget instances and options
- Can I individually style items in the backend widget list?
- How to Download and install plugin database remotely
- Sidebar widget to show popular post not working?
- Data inserted by wpdb insert is different than data pressnt in database.
- Proper Prepare Statement for ALTER TABLE and using AFTER
- $wpdb->prepare is not working like mysql_real_escape_string
- How to avoid conflicts with db.php / $wpdb and other plugins that decide to use them?
- $wpdb in php 5.5
- WordPress dynamic widget by location?
- Plugin to create Posts and Forums then choose category and parent forum
- $wpdb->update Issue
- How to relate the Category to user?
- Can / should a widget plugin define its own Widget Area?
- How to exclude categories from get_categories() select list inside a widget admin panel
- Widget internal hooks and functions
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Why doesn’t my Table get created?
- My plugin creates custom widgets, How can I programatically add them to existing sidebar widget areas?
- How to show multiple instances of the WP125 Widget?
- Console errors in 6.0-RC1 Widget screen
- How to display specific data from a custom table to logged in users with a custom role
- $wpbd->insert_id is returning null
- Error code when migrate
- How does update method in Widget class saves $instance array from Select tag?
- How to store sensitive user data (passwords)
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- Quick Draft widget (dashboard.php) using custom post_type
- WordPress Query doesn’t return the correct value
- Uncaught Error: Call to undefined function wp_get_current_user() in
- Load script on frontend from widget plugin
- Can’t get wpColorPicker to work in a widget
- If user is logged-in display/hide widgets ( siteorigine) [closed]
- User avatar-ACF fields
- Set widget icon in Customizer?
- bindParam? WordPress 4.9.5 SQL LIKE statement %s and %LIKE%
- Update database record in plugin
- How to embed or integrated a custom WordPress Widget into the theme?
- Dedicated server and WPDB Class : huge slow-down of the website
- How to implement pagination into a wpdb->result query?
- How to CRUD from wordpress database in wordpress theme?
- Widget won’t be activated
- Dynamic sidebar areas not working on the Theme Customizer
- I can’t write in my DB using $wpdb->insert
- $wpdb how can i save my postmeta table before querying it
- Downloading Generated XML File
- Detect each active instance of a widget
- wp_register_sidebar_widget in loop within a plugin?
- grouping my widgets wordpress
- Get fields of a widget
- WordPress plugin tables become corrupt
- How do I create Widget within plugin that uses its own class?
- Best practice to include custom user styles in widgets
- Nothing happens on WordPress Update command
- How to specify widget order or css name via script?
- Fixing plugin for wpdb::prepare
- How can I create a custom plugin to call webapi after user registration?
- Is it possible to add Custom Dashboard Widgets to Custom Admin Menu Page?
- multiple record insert creating many duplicate records
- How do I cause plugin patterns to appear in the widget areas?