Hi Paul,
I've been looking into this a little more but can still not identify where the error is occurring. I'm sure this is due to my inexperience with data types and numerals etc.
What I have noticed is this, the SQL data file is provided from the client with the prices inserted correctly, in this case in the format 123,50 etc. Once they are run through MySQL those numbers are rounded up/down and shown as 123,00 etc.
I've included sample code / data structure below in case there is some major booboo there.
Locally I'm using MySQLfront and did try to change the data type from float(10,2) to decimal(10,2) but this produced an error.
Someone has suggested that the problem lies with the format of the prices at import level - ie. 123,50 should be imported as 123.50 (hence it is ignoring everything after the comma), but if this is the numeral system here (Spain) obviously I can't ask the client to provide their prices in another format. If this is in fact the case is there some sort of workaround?
Any ideas?
Thanks in advance and all help / pointers appreciated!
Gary
PS. My First DB. I'll write the book from hell about it afterwards!
I'm using the following pieces of code -
Table structure:
CREATE TABLE productos (
Pedido varchar(7),
Titulo varchar(100),
ID int(4) unsigned,
Precio_Basico float(10,2),
Cuota_A float(10,2),
Cuota_B float(10,2),
Cuota_C float(10,2),
Year int(6) unsigned,
Formato_Obra varchar(60),
Formato_Papel varchar(60),
Tipo_Papel int(2) unsigned,
Tecnica varchar(100),
Descripcion_es text,
Descripcion_en text
) TYPE=MyISAM;
Sample row:
INSERT INTO productos VALUES("10272","El criticón","306","89,55","85,07","80,6","71,64","", "","","","","","");
To display the prices:
Spanish format <?PHP echo number_format($row["Cuota_A"], 2, ',', '.'); ?>
UK / US format <?PHP echo $row["Cuota_A"] ?>