use this snippet it works
<?php if(isset($_POST["ICNo"])) {
global $wpdb;
$name = $_POST["ICNo"];
$resultsap = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM wp_apelc_users WHERE icno = %s", $name ) );
foreach ($resultsap as $row) {
echo 'Name: ' . $row->name;
}
}
?>
<form method="post">
<div>
Your IC No: <input type="text" name="ICNo">
<input type="submit" name="submit" value="Submit" >
</div>
</form>
Related Posts:
- How to return number of found rows from SELECT query
- What is the meaning of %s, %1$s etc.? [closed]
- Include WP_Query in my own PHP file?
- Can i use php sql functions instead of $wpdb?
- $wpdb->get_results(…) returns empty array despite correct query
- $wpdb->delete column values IN ARRAY()?
- wpdb::prepare was called incorrectly
- Custom query to get post names beginning with a digit
- Has anyone tried putting PHP ActiveRecord on WordPress?
- queries inside of a class
- Copyright info change in Theme Child PHP
- Add footer.php to WordPress child theme
- How to display only first value of database column in WordPress
- Print out WordPress user ID – two sites with same code but different output
- I want to remove the links from the term list returned by get_the_term_list
- WPDB: how to get the value of a field in a custom database table
- Can’t use get_results() in ajax query
- Can I run custom php on specific pages in wordpress?
- Successful or Error Message after running mysql code in functions.php
- PHP syntax error when using wpdb update?
- Can I view my own wordpress php source code on my hosted web server?
- How do i get (unique) page name?
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- Export WordPress Table to CSV from page
- WordPress get pagination on wpdb get_results
- How to display posts of specific category using a custom Query in WordPress?
- How to display php source code inside a post using visual editor?
- The custom logo, site title, and description doesn’t appear at the same time
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- How to Fetch values from WP database based on selected option value by onchange using PHP?
- stats_get_csv (WordPress Stats) to only display top posts (not pages)
- $wpdb->flush(); breaks the loop
- Call External Object in Class Function During Callback
- Why is variable not working on custom sql query using wpdb?
- Hide wordpress field if data is empty in post!
- Show MySQL errors that occur when I excute $wpdb->insert()
- How to get the POST TITLE using the POST ID?
- Get stock by custom meta field on all Woocommerce variable products
- Any possible way to make $wpdb->get_results() return anything else than array?
- database interactions using OOP
- how to delete 30 day old data using PHP [closed]
- Echo a hierarchical list of post data from custom fields
- Display fields as values in array from external SQL DB
- Can’t get wp_insert_post to work
- Trying to establish connection to External Database
- Getting id of poll from WP database
- How to insert a single row to WP database table?
- WSoD being caused by this piece of code
- I want to select the from values from database in WordPress? [closed]
- Latest post in a specific menu
- Cause of Blank Lines Being Added to WP FIles?
- $wpdb->update with multiple parameters gives error
- How to save checkbox values for logged in users?
- Querying wpdb using PHP
- Update results, Before deleting the related category [closed]
- How WordPress reacts to a lack of memory of the server [closed]
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- wp query foreach deleting record returning only first or last item
- Using the same shortcode to show any table from the database
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- Blog only showing code
- Get null from POST
- Display pages from specific page template
- Querying multiple meta_keys in WordPress SQL query
- MySQL database migration to WordPress
- why is markup routinely placed in functions in wordpress?
- Themes with variable width or single columns? I want to display source code
- Open all external links in new window – need help with the code
- Fetching wpdb data from a php file seems to break?
- How do you get a reference to $wpdb in a PHP script
- How to get the Woocoomerce subtotal value without tax in the hardcode? [closed]
- Insert into db with foreach problem
- Where to put include php file?
- Can you not edit the HTML and PHP of your WordPress without paying?
- posts_clauses drop ACF get_field function
- How to display inputted data in Ajax without button or click event
- WordPress Query -> Ajax Query
- how to display tables via ajax
- Changing regular db connection to $wpdb
- Can’t send form data to wpdb when URL has query string
- inner-wrap div pushing custom table far down on page
- use wpdb object on other file
- Dynamically added text at bottom of article – non searchable by PHP code
- $wpdb how to make a record lookup
- How to get data (not value or name) from radio options to POST to database
- Error resetting database index using ALTER TABLE in $wpdb->query
- I have an error WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version
- Warning: Undefined property: wpdb::$question_overview in C:\Wamp.NET\sites\proxyvragenmodule\wordpress\wp-includes\class-wpdb.php
- WordPress / PHP: Check if column has value and then check if value in array
- Putting form result in my database
- how to create twitter card without plugin in wordpress website?
- SQL – How to echo out inside of where statement
- How can I update a value of a field depending on outside source?
- $wpdb->insert writes a record twice for some reason, when my custom developed plugin calls my class function once
- How to properly prepare a column name if passed to a stored procedure?
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- get_var not returning a value when the field contains an apostrophe
- How to connect wordpress with db using ssl client certificate
- Trouble getting wpdb to work – first time