Hi in Paypal after transaction the amount should be stored in database.but decimal amount is not storing in the database it convert into whole number.i want to store it in database as decimal number.
for example:amt = 0.5 it storing in MySQL database as 1.i want to store it in database as 0.5
can anyone help me how to do with query.
thanks in advance.
i m new to Paypal and MySQL.if any mistake in my question please fg.
This is my Code
<?php
define("DB_HOST", "localhost");
define("DB_USERNAME", "root");
define("DB_PASSWORD", "");
define("DB_DATABASE", "test");
$connect = mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD) or die("Database Connection Error");
mysql_select_db(DB_DATABASE) or ("Database Selection Error");
session_start();
$uid = $_SESSION['uid'];
$username=$_SESSION['username'];
$item_no = isset($_GET['item_number']) ? $_GET['item_number'] : null;
$item_transaction = isset($_GET['tx']) ? $_GET['tx'] : null ;
$item_price = isset($_GET['amt']) ? $_GET['amt'] : null ;
$item_currency = isset($_GET['cc']) ? $_GET['cc'] : null ;;
$result = mysql_query("INSERT INTO sales(pid, uid, saledate,transactionid,amt) VALUES('$item_no', '$uid', NOW(),'$item_transaction','$item_price')");
if($result){
echo "<h1>Welcome, $username</h1>";
echo '<h1>Payment Successful</h1>';
}else{
echo "Payment Error";
}
?>
Your data type of the column must be
decimaland must haveprecision and scale. Theprecisionrepresents the number of significant digits that are stored for values, and thescalerepresents the number of digits that can be stored following the decimal point.Example
by default the value of precision is 10 and the scale is 0. If the value of your scale is
0then it will not have decimal value and causing to round the value you inserted.SQLFiddle Demo