I have a custom self made registration form where a user needs to enter his address, I need to check if his address is already added in a custom table(which I have made manually with table prefix). I am using a custom function in my function.php file.
function my_custom_action(){
$myinput = $_POST['address'];
global $wpdb;
$table_name = 'wp44_predefined_address';
$result = $wpdb->get_row("SELECT * FROM wp44_predefined_address WHERE 'UPPER(Address1)' LIKE 'UPPER(%s)'", $myinput);
print_r ($result);
die();
}
All I am getting is a Null value in my console. I have converted the strings into Uppercase also, I have used quotes also.
I have used LIKE, but I also used = ,
I am using $wpdb->get_row
, I have also used , get_var or get_result.
So what I am doing wrong ?
LIKE
, you only need=
. If not, I'm afraid it's not that simple, as you'll need to build a fuzzy match library. – Ciprian Jul 19 '18 at 15:49