i am trying to save number of cents in MySql table as float , but the database is taking it wrong , for example i am saving 0.01, its saved as 0.1 !
is it possible to make this happen ?
My Code ;
$return["reward"] = 0.05;
$api->user['balance'] += $return["reward"];
$q = $api->pdo->prepare("UPDATE " . DB_PREFIX . "user
SET
balance = :balance
WHERE
userid = :userid");
$q->bindParam(":balance" , $api->user['balance'] , PDO::PARAM_INT );
$q->bindParam(":userid" , $api->user['userid'] , PDO::PARAM_INT);
the balance column TYPE float in database.
balancecolumn have?PDO::PARAM_INTwill save it using an integer, so not sure how this then comes out as 0.1. I would have expected either 0 or 1.PDO::PARAM_STR, check this post: stackoverflow.com/questions/2718628/pdoparam-for-type-decimal Maybe your database config is wrong?PDO::PARAM_STRstill same