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:
- 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?
- Custom query to get post names beginning with a digit
- queries inside of a class
- Copyright info change in Theme Child PHP
- Add footer.php to WordPress child theme
- I want to remove the links from the term list returned by get_the_term_list
- How do i get (unique) page name?
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- 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)
- Call External Object in Class Function During Callback
- Why is variable not working on custom sql query using wpdb?
- How to get the POST TITLE using the POST ID?
- Can’t get wp_insert_post to work
- Trying to establish connection to External 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]
- Cause of Blank Lines Being Added to WP FIles?
- $wpdb->update with multiple parameters gives error
- Update results, Before deleting the related category [closed]
- How WordPress reacts to a lack of memory of the server [closed]
- wp query foreach deleting record returning only first or last item
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- $wpdb->insert() does not Insert record in a table
- Insert custom PHP head above in WP pages
- Log in / Log Out Custom Button
- How to do a code in php and have text before it? [closed]
- PHP nested If statement syntax
- Display Data in Table from External Database in WP using Shortcodes
- Error using WordPress $wpdb object to get result from custom table
- How to retrieve the data from the sever and displaying it in a page?
- Querying Database with wpdb
- Can’t update multiple rows with $wpdb query
- Mixing variables into an array when inserting values
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- how to get serialized post meta
- Code snippet to show current php version inside “At a Glance” box in admin
- Basic wpdb update question
- I can’t update my data through $wpdb
- wpdb Cannot Update column in Database
- Output: “Array”
- Delete database record using plugin from admin panel
- Cannot access $wpdb, comes back NULL
- Wpdb get->results to out the the month from the db
- How do I prepare strings for insertions as values into a MySQL table?
- WPDB – Read and write value from / to database
- form $_post action value gets truncated after it passes through two forms
- Why my query does not run with prepare
- How to Generate a list of Most Commented post?
- Why won’t this wpdb get_results query return results?
- Accidentally deleted php code in WordPress website [closed]
- wpdb getting avatars and author url
- Undefined variable: row?
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- random reason on refresh
- WordPress SQL JOIN query
- populate select options from extra mysql table data
- Add posts to custom table in database instead of wp_posts
- Convert a column of a table containing an Array as response in HTML
- Woocommerce template file outputting tags
- Creating multiple tables with Plugin
- Conditional formatting on data fetched from MYSQL
- Using wpdb to connect to a different database is not working
- Looping through custom data in a custom table to display all items in a post
- How do I create a WP endpoint that retrieves all custom post types that have a tag?
- How to grab data from input and store it into custom table in database?
- admin-ajax.php 400 bad request – whats wrong with my code?
- Rewrite SQL query as a prepared statement and use in foreach loop
- How to return count of items found in SQL query
- Update user_email via php – WP 4.7
- Unable to pass variable to database
- Passed variable gets undefined variable error on insert on next page
- Run insert if no entry otherwise run update with ajax
- Display pages from specific page template
- Querying multiple meta_keys in WordPress SQL query
- MySQL database migration to WordPress
- Open all external links in new window – need help with the code
- How do you get a reference to $wpdb in a PHP script
- Where to put include php file?
- Can you not edit the HTML and PHP of your WordPress without paying?
- 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
- 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
- Error resetting database index using ALTER TABLE in $wpdb->query
- 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
- how to create twitter card without plugin in wordpress website?