Hey guys so I am trying to access my database which is within wordpress to get some field values and I tried doing just straight up PDO style but it seems to not work so I went into wordpress codex and did their way to call things, but still no success!
CODE:
/***GET USERNAME***/
global $current_user;
get_currentuserinfo();
$accusername = $current_user->user_login ;
/******SEE IF FIRST TIME DISCOUNT CODE BEEN USED*******/
$wpdb->query(
$wpdb->prepare(
"
SELECT firsttime_discount
FROM $wpdb->users
WHERE user-login = %d
",
$accusername
)
);
/******CHECK IT******/
echo"working";
$wpdb->query('query');
echo"working";
if ($checkFTDiscount->firsttimediscount != 1){
$validFTDiscount = 1;
}
else{
$validFTDiscount = 0;
echo"wori";
}
So it's suppose to go in and see if the value for discount code is set to 1 in the wp_user area, and if not just set a value to 0.
Let me know if you have any other questions.