Jump to content

please help me


dickybella85

Recommended Posts

A non well formed numeric value encountered 
 

please help me for this

 

 
 

 

<?php
 
    $prix = number_format($prix, 2, '.', ' ');
    if($prix != 0)
    echo '<p class="p_prix_info_ann"><span class="vert">'. $language['page_ann_prix'] .' :</span> '. $param_gen['devise'] .' '. $prix .'</p>';
 
?>
 

 

Link to comment
Share on other sites

Ok. Well those two lines would not produce that error. Its is the line with number_format() producing that error.

 

It seems the value ($prix) you are giving number_format is not a number this why you are getting the error. How is $prix defined before that line?

Link to comment
Share on other sites

For what it's worth, I was able to replicate the error with the following lines of code:

$number = ' 234234234 ';
print number_format($number, 2, '.', ' ') . '<br>';
 
The number_format() function doesn't seem to like spaces. Have you tried using var_dump() to see the exact value of $prix?
Link to comment
Share on other sites

like this?

 

<?php
 
    $prix = number_format ($prix, 2, '.', ' ');
    var_dump($prix);
    if($prix != 0)
    echo '<p class="p_prix_info_ann"><span class="vert">'. $language['page_ann_prix'] .' :</span> '. $param_gen['devise'] .' '. $prix .'</p>';
 
?>
Link to comment
Share on other sites

Good luck with that, cyberRobot. He's been asked several times already

 

I guess the error is from number_format()? The three lines you posted look ok. So it looks like $prix is not a number can you tell us how and where that variable is defined?

 

 

Ok. Well those two lines would not produce that error. Its is the line with number_format() producing that error.

 

It seems the value ($prix) you are giving number_format is not a number this why you are getting the error. How is $prix defined before that line?

 

 

Could you show us the code that defines $prix?

Link to comment
Share on other sites

 $prix should be a numeric value which contains only numbers no special characters allowed.

   

For example :

 

$prix = 12345;  not as $prix = $12345

 

$prix = number_format($prix, 2, '.', ' ');

    if($prix != 0)

    echo '<p class="p_prix_info_ann"><span class="vert">'. $language['page_ann_prix'] .' :</span> '. $param_gen['devise'] .' '. $prix .'</p>';

 

 

which gives :  12 345.00 when $prix is 12345

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.