Check out the codex on wpdb. In your case, get_row returns the first row of the result set as an object. There’s no need for any mysqli_* functions when using $wpdb.
if ( $result2 )
echo json_encode( $result2 );
And a heads up for SQL injection – use the prepare method:
$wpdb->get_row(
$wpdb->prepare(
"SELECT * FROM {$myoptionValue['tablename']} WHERE personeelsNummer = %s",
$q
)
);
If personeelsNummer is an integer, use the placeholder %d instead of %s
Related Posts:
- How to delete all records from or empty a custom database table?
- dbDelta only creates the last table
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- Stackoverflow type of badge plugin giving warnings in WordPress 3.5
- Missing argument 2 for wpdb::prepare() Issue
- ob_end_flush error when using wpdb in plugin
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- post_content getting cut off on blank space on $wpdb->update
- Why am i getting this error? WordPress database error: [Query was empty]
- Inserting large amounts of data into a custom table during plugin install
- plugin ajax to external php file always return null
- When to call add_filter
- Doubt using $wpbd->get_col for a single column
- Access WordPress database outside of WordPress
- Correct way to perform non-cacheable DB query
- Help With MySQL to WPDB Query Conversion
- Creating mySQL procedure with $wpdb
- Problem with creating tables for Plugin
- Change commission_status paid when withdraw_status vendor is completed
- $wpdb->get_row returns column name instead of column value
- Create a table with wordpress plugin boilerplate
- plugin code is pulling information from database in one instance and not in other. What is wrong?
- Object method calling for global $wpdb in header.php
- Using wpdb without loading all plug-ins via wp-load.php
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- How to insert multiple postmeta values with one query?
- Cannot get wpdb data (Error in a simple fuction) [closed]
- WPDB: Update table
- Issue running db create table query from static method
- $wpdb update query in plugin only updating one column
- Mowing site to another domain in simplest way
- Store plugin page content in wp_options?
- Displaying data from another database
- How to access the WordPress DB from a plugin file
- WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version [closed]
- Linked pages from plugin on front can’t see $wpdb
- Need help creating asynchronous data scraper in WordPress
- ob_end_flush(): failed to send buffer of zlib output compression (0) in external php
- How to fetch WordPress database values in JavaScript widget
- $wpdb->delete not working for me
- any word search WordPress
- How to securely controlling data without keeping it in postmeta?
- Using id to show item
- No result after wpdb->insert
- How to fix slow comment query?
- Write mysql credentials in plugin
- Action hook “wp_insert_post” works but not for last imported post
- Proper way to trigger a MySQL query via link in a plugin
- get_var result empty for query of custom table in plugin admin
- Making plugin to use different table prefix cause permission problem
- Is it safe to increase/alter the size of the wp_post.guid column from VARCHAR(255) to VARCHAR(2048)?
- Get all the related data from WordPress DB
- $wpdb selects wrong database
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- FATAL ERROR: WP complains about redeclaration [closed]
- How to check record is exist or not in WordPress CRUD Operation with $wpdb
- wp db request without refreshing the page
- How to enable suggested edits?
- How to change a user’s password programatically
- wordpress on localhost lamp doesn’t let me install plugins
- WP_User_Query and non-unique usermeta data
- How to delete custom taxonomy terms in plugin’s uninstall.php?
- To Disable WordPress Rest API or Not To Disable?
- how to include other plugins css files in a shortcode?
- Redirect to settings page after install
- Email Notifications of new posts to users – suggestions [closed]
- What is the correct way for a theme to support plugin UIs?
- What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
- Get URL of a specific file
- Building a plugin that doesn’t break when deactivated
- How does WordPress determine the primary plugin PHP file?
- translation does not work with text_domain
- Data sanitization escaping HTML apostrophes
- Custom comment type maybe?
- Remove Adminstrator Hyperlink from a user having role to add and see users
- Enable comments for post with comments meta box removed
- adding a text message beside the comment submit button
- Overide a function that is inside a plugin
- Having separate plugins and themes folder for multi-site setup
- Is there a plugin to record querystring parameters for a page (for customer tracking)? [closed]
- If I delete plugins via FTP are settings kept in DB?
- Many plugins making WordPress run slow by design?
- Why are some of my thumbnails not being generated?
- Remove caching from wp_remote_get calls from custom plugin
- Detect the activated theme from plugin code
- Transient unique names
- Add keywords meta to index.php page
- Can’t delete Draft Post [closed]
- How to check if tables in WordPress still exists after activations
- Looking for a way that will collect visitors emails before letting them view the blog posts [closed]
- Force file download on plugin activation
- How can I inject options into an select tag inside the widget form?
- WordPress user account activation
- Init plugin again after ajax call finish
- Unicode characters displaying as ? after import using WP Clone
- Shortcode to do math with url variables
- Disappearing plugins
- Let a user change role dynamically on the front end
- Help with coding a link for a button in WordPress with The Events Calendar Plugin
- How to change css poperty through webhook in wordpress