Jump to content

[SOLVED] help with a query


isedeasy

Recommended Posts

I have a query that needs to multiple a number of clicks with a constant (defined earlier on) and store it in the row. This is what I have...

 

define ( "PPC", 0.01);

mysql_query("UPDATE deals SET earnings=".PPC."*clicks WHERE id='$id'") or die(mysql_error());

 

The column 'earnings' is a DECIMAL(3,2)

 

When ever this query is ran I get the value 9.99 in the earnings column. I am sure its something simple I am overlooking but its starting to frustrate me.

 

Cheers for any help

 

 

Link to comment
https://forums.phpfreaks.com/topic/181625-solved-help-with-a-query/
Share on other sites

DECIMAL columns in MySQL 5.1 do not allow values larger than the range implied by the column definition. For example, a DECIMAL(3,0) column supports a range of -999 to 999. A DECIMAL(M,D) column allows at most M - D digits to the left of the decimal point. This is not compatible with applications relying on older versions of MySQL that allowed storing an extra digit in lieu of a + sign.

 

The above should explain what's happening clearly, to fix just increase your DECIMAL(M,D) to what you need.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.