Jump to content

setting Up a Money Field?


DarrenReeder

Recommended Posts

Hello, i am currently making a small game type thing and i want to have a money field... I have tried a few different field types to get exactly what i want but nothing seems to be working... i want to save money so its in the form 1,000,000 and then 560,000,000 e.t.c. so its easy to read for people... none of the int field types support the ',' as far as i know and ive tried a few thats its not working for...

 

i decided that i should just use VarChar and enter 1,000,000 then echo that out to show ammount of cash i got and...it works!!

 

However, i i have now started to use this field in code and im trying to check if i have enough cash by basicly doing code like this:

 

if($mymoney < $neededmoney)
{
echo "test";
}

 

However this is not working because i THInk its just thinks that the value of $mymoney is 1 (1,000,000)...Wen i type use 1 for the number then test will Show up however if i type 2 then it wont show.. (i think...im confusing myself)

 

so anything i need a way of saving 1,000,000 as the number 1000000 - also ive tried useing INT for 1000000 but then it STILL just saves it as 1...when i echo this out it even shows it as '1' not '1000000'...

 

any help would be great!

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.