Jump to content

Problem with MySQL and 0


Reap38
Go to solution Solved by Reap38,

Recommended Posts

O have a value of coin base system and the user may have 73020 coins 
now the data base reads out the 73020 coins no problem but 
the php is not reading the last 0 because its a null or empty or something and its just not liking the 0 at the end of the string

so lets say 
$mycoins = $row['mycoins'];
and this echos out 73020

what this 73020 is really saying is this
once its all converted out correctly

$73.02%0

So what I thought I needed to do was count the string first to get all the numbers and place if count == 5 I could do the row statement for the ten dollar section or if count == 6 i could so that row for the hundreds and so on.

but i can not solve the 0 issue 

so lets write a simple code 


 

 

<code> 
$mycoins = '73020';

$count_mycoins_string = strlen($mycoins);
echo $count_mycoins_string;

I would think the result would be 5
but it counts 4 because the last number of the string is 0 how can i fix that?
</code>

Edited by Reap38
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.