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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.