Hey guys so I am trying to grab a value from my database but for some reason its not turning out the way it should be. I am calling everything through wordpress $wpdb.
CODE:
/***GET USERNAME***/
global $current_user, $wpdb;
get_currentuserinfo();
$accusername = $current_user->user_login ;
/******SEE IF FIRST TIME DISCOUNT CODE BEEN USED*******/
$checkFTDiscount = $wpdb->get_var( $wpdb->prepare(
"
SELECT firsttime_discount
FROM $wpdb->users
WHERE user-login = %d
",
$accusername
) );
echo $checkFTDiscount;
So technically I should get the value 1 from this because in the data field its drawing from – which is an int(2) – is set to 1 for this user.
Let me know if you need any other info.
Thanks for the help!
EDITED
Once value is gotten it sets these –
if ($checkFTDiscount == 1){
$validFTDiscount = 1;
}
else if ($checkFTDiscount == 0){
$validFTDiscount = 0;
}
This does not happen though.
In your example
should be