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
- What are these entries in the database? Looks similar to JSON
- Add content to /wp-admin/plugin-install.php admin screens
- How to make sure a wp-cron job runs
- Open external links in a new window
- Can’t use /wp-json/wp/v2/plugins API endpoint even as administrator
- I am trying to match the wpallimport using the Xpath Filter
- Showing Co-Authors on post page
- How do I store information in a dynamic block in WordPress?
- Shortcode doesn’t work if I directly paste its function in a template file?
- How to get the HTML until ?
- How to generate video out of images via WordPress plugin
- Events Made Easy Plugin – Duplicate Title Tags
- Can’t Update, Delete, install Plugin
- Get plugin option in another PHP file
- How can I add hyperlink in WP_Error message?
- In the archive widget, how do I sort in between two years?
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- Set plugin-values when creating post via REST-API
- Allow customers to download updated versions of software
- Plugin retrieving results even after uninstallation
- Edit / Change Jetpack Mobile Theme [closed]
- How to set category correctly for a custom post created by a remote API call?
- Translation issue with global variables
- How to redirect non www to www? [closed]
- How to add category and subcategory in WordPress custom code?
- Minimalistic schedular
- FacetWP breaks jQuery events
- How do I display PHP file contents on front end of WordPress?
- How to apply to hide TinyMCE (wp_editor) on button click
- How to send the featured image of a post to an API?
- jQuery Ajax not loading page with ACF fields
- How can I translate something in my class constructor of my plugin in WordPress?
- Which post/page an image is attached to
- Theme that includes a “core” plugin but the files in theme and child folder ignored
- Woocommerce Attribute price for non-variations
- My wp database has been hacked
- Customize CSS for “Swipebox ” lightbox
- Best use adding user generated JS/CSS to a theme with a plugin
- How to create an uploads subfolder on a multisite setup?
- API Functions to Register and Show WordPress List Tables
- Getting error of unexpected output during activation
- Jquery UI implementation [closed]
- Wanted: PayPal plugin for WordPress [closed]
- Getting error when accessing Customizer Page