List:General Discussion« Previous MessageNext Message »
From:Robert Pruitt Date:August 23 1999 9:42pm
Subject:Error creation --
View as plain text  
Hi.

I have a small table --

CREATE TABLE diecast (
     stock_number varchar(20) binary NOT NULL,
     item_description tinyblob NOT NULL,
     sales_price decimal(7,2) DEFAULT '0.00' NOT NULL,
     class char(1) DEFAULT 'n' NOT NULL,
     PRIMARY KEY (stock_number));

And a small PHP script --

$query = "INSERT INTO diecast VALUES ('$stock_number',
'$item_description', '$sales_price', '$class')";

My problem is the user sometimes enters sales price as $1.00 instead
of 1.00 into the form text box. <input type=text name='sales_price'>
No errors are forthcoming. He might sit there doing this for an hour,
before realizing that now all his work shows price as $0.00 as the
final result.

Can I force an error if the user enters a $ into this field? What's
the best way to handle this?

Thanks,
Robert


Thread
Error creation --Robert Pruitt23 Aug
  • Re: Error creation --Paul DuBois23 Aug
  • Re: Error creation --ed24 Aug
    • Re: Error creation --Thimble Smith24 Aug