I'm keep getting 99 when inserting a variable to a decimal
Posted: Sat Dec 11, 2010 11:52 pm
I'm attempting to insert into my database. I tried all kinds of values for the txtAmount textbox but I have 99 listed in the database.
I type 100.35 and there is a 99
I type 550.00 and there is a 99
delimiter $$
CREATE TABLE `t_transactions` (
`transaction_id` int(11) NOT NULL AUTO_INCREMENT,
`roommate_id` int(11) NOT NULL,
`date` datetime NOT NULL,
`description` text,
`memo` text,
`amount` decimal(2,0) NOT NULL,
PRIMARY KEY (`transaction_id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1$$
I type 100.35 and there is a 99
I type 550.00 and there is a 99
delimiter $$
CREATE TABLE `t_transactions` (
`transaction_id` int(11) NOT NULL AUTO_INCREMENT,
`roommate_id` int(11) NOT NULL,
`date` datetime NOT NULL,
`description` text,
`memo` text,
`amount` decimal(2,0) NOT NULL,
PRIMARY KEY (`transaction_id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1$$
Code: Select all
$roommate_id=$_SESSION["roommate_id"];
$date = date("Y-m-d");
$description = $_POST['txtDescrip'];
$memo = $_POST['txtMemo'];
$amount = $_POST['txtAmount'];
echo $roommate_id . $date . $description . $memo . $amount;
mysql_query("INSERT INTO t_transactions (roommate_id, date, description, memo, amount)
VALUES ('$roommate_id', '$date', '$description', '$memo', '$amount')") or die(mysql_error());