Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-06-2006, 04:41 AM   #1 (permalink)
jumpmuppet
Registered User
 
Join Date: Sep 2006
Posts: 3
jumpmuppet is on a distinguished road
Money_Format problem?

PHP Code:
////////////turn it into currency/////////////////////
setlocale(LC_MONETARY'en_US');
$price =  money_format('%(#10n'$price) ;    
$pricehigh =  money_format('%(#10n'$pricehigh) ;    
////////////turn it into currency///////////////////// 
I know this was originally designed to run on Linux servers.. just need to change the function MONEY_FORMAT to NUMBER_FORMAT, but not quite sure what else should go with it???

Any takers??

Last edited by redhead; 09-06-2006 at 07:32 AM.
jumpmuppet is offline   Reply With Quote
Old 09-06-2006, 07:33 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,490
sde is on a distinguished road
give us an example of $price before it gets put into the function.

then, give us an example of the exact text you want to convert it to.
__________________
Mike
sde is offline   Reply With Quote
Old 09-06-2006, 07:57 AM   #3 (permalink)
jumpmuppet
Registered User
 
Join Date: Sep 2006
Posts: 3
jumpmuppet is on a distinguished road
Money_format function

Thanks for getting back to me....

to give you a better understanding of what i,am trying to atain... this is based on a property search enginge so i can enter into my control.php the property $price..

This $price would be stored in my MYSQL database.. once entered the price would be displayed to the user on the broswe.php or search.php..

PHP Code:
//////////////Find a single listing record///////////////////////////////////
    
function findListing()
        {
        
$id $_GET['id'];
        
$sql mysql_query("SELECT * FROM info WHERE pk = '$id'");
        while (
$row mysql_fetch_assoc($sql))
            {
            global 
$dateentered,$name,$address,$city,$state,$zip,$telephone,$fax,$website,$email,$description,
            
$bedrooms,$bedroomshigh,$sqfeet,$price,$pricehigh,$pricetype,$category,$location,$proptype,$view,
            
$units,$delivery,$developer,$fees,$unitsperfloor,$stories,$image1,$image2,$image3,$image4,$image5,
            
$image6,$image7,$image8,$image9,$image10,$image11,$image12,$featured,$mls,$active,$agent,$features;
            
$dateentered $row['dateentered'];
            
$name $row['name'];
            
$address $row['address'];
            
$city $row['city'];
            
$state $row['state'];
            
$zip $row['zip'];
            
$telephone $row['telephone'];
            
$fax $row['fax'];
            
$website $row['website'];
            
$email $row['email'];
            
$description stripslashes($row['description']);
            
$bedrooms $row['bedrooms'];
            
$bedroomshigh $row['bedroomshigh'];
            
$sqfeet $row['sqfeet'];
            
$price $row['price'];
            
$pricehigh $row['pricehigh'];
            
$pricetype $row['pricetype'];
            
$category $row['category'];
            
$location $row['location'];
            
$proptype $row['proptype'];
            
$view $row['view'];
            
$units $row['units'];
            
$delivery $row['delivery'];
            
$developer $row['developer'];
            
$fees $row['fees'];
            
$unitsperfloor $row['unitsperfloor'];
            
$stories $row['stories'];
            
$image1 $row['image1'];
            
$image2 $row['image2'];
            
$image3 $row['image3'];
            
$image4 $row['image4'];
            
$image5 $row['image5'];
            
$image6 $row['image6'];
            
$image7 $row['image7'];
            
$image8 $row['image8'];
            
$image9 $row['image9'];
            
$image10 $row['image10'];
            
$image11 $row['image11'];
            
$image12 $row['image12'];
            
$featured $row['featured'];
            
$mls $row['mls'];
            
$active $row['active'];
            
$agent  unserialize($row['agent']);
            
$features unserialize($row['features']);
            }
////////////turn it into currency/////////////////////
setlocale(LC_MONETARY'en_US');
$price =  money_format('%(#10n'$price) ;    
$pricehigh =  money_format('%(#10n'$pricehigh) ;    
////////////turn it into currency///////////////////// 
        
}
//////////////////////////////////////////////////////////////////////////////// 
hope this helps?? many thanks!!

Last edited by redhead; 09-06-2006 at 08:02 AM. Reason: Use either [code] tags or [php] tags.
jumpmuppet is offline   Reply With Quote
Old 09-06-2006, 08:07 AM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,713
redhead is on a distinguished road
I think sde was reffering to some explanation like:
Quote:
I have a problem, I want to convert a number like: 23.45 to a user given LOCAL_LANGUAGE specification, given if a user has defined to use LANG_DA, the equivalent value would be 23,45, were it a user having the setting of LANG_US it would be displayed as 23.45
The code snipit you've provided dosn't quite satisfy the answered question.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 09-06-2006, 08:26 AM   #5 (permalink)
jumpmuppet
Registered User
 
Join Date: Sep 2006
Posts: 3
jumpmuppet is on a distinguished road
My inexperiance shows then... thanks redhead!

The problem is in short,, when i enter the value of $price via my control.php it does not display it to the user... ?????? there is no requirement to change the currency all i want to do is display the price of the property to the user, and for the user to be able to define a search under $price or $pricehigh....

Does that make any sense???

cos i,am drowing and probably a bit outa my depth.... Thanks Alll
jumpmuppet is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error problem in game.. can't seem to find problem solution. slashdot Standard C, C++ 5 08-03-2005 08:15 PM
JSP code problem j.gohel Java 7 04-15-2005 02:07 PM
Hashing problem jodders Standard C, C++ 1 02-09-2005 01:51 PM
Problem Assignment (Urgent help req.) Boltress Standard C, C++ 0 01-12-2005 07:59 AM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 04:44 PM


All times are GMT -8. The time now is 06:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting