php - Oddly some times value float value returns 0 -
i'm beginner @ php trying solve usage of pdo in php...
i have pdo query: returns correct value (integer 1) don't know how, returns (0 or null) happens randomly , no idea why.
server windows based. double checked database.. multiplier values (integer 1)
$q = $db->prepare("select multiplier,balance buoys id=:id"); $aid = $_post['id']; $afishvalue = (float)0.4; $q->execute(array(':id' => $aid)); $res = $q->fetch(pdo::fetch_obj); $aevent = (integer)$res->multiplier; // how value times returns 0 values in database integer 1. $abuoybalance = (float)$res->balance; $afishvalue = (float)$afishvalue * (float)$aevent;
most of time $afishvalue
returns correctly times returns null. i'm totally stuck , googled hours... no idea next.
there few things check:
$q->execute(array(':id' => $aid)); $res = $q->fetch(pdo::fetch_obj);
on both of above statements, return should checked error event
Comments
Post a Comment