I would like to have a comma displayed on my website for counts over 999, for example 1,000 instead of 1000 or 15,050 instead of 15050.
I tried number_format in PHP but I'm not sure where I would add the code exactly.
Any help would be greatly appreciated!
Thanks!
Add comma to display counts over 3 digits?
Which script exactly are you using?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Try opening display.php in Notepad and change to
Upload the modified file, close all browser windows, open the page with counts again and see if it worked. If not try refreshing the page.
Code: Select all
echo "ccount_link[$id]=$count;\n";
Code: Select all
echo "ccount_link[$id]='".number_format($count)."';\n";
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Klem just had an idea, why can't you add this as an option to the script so it can then be chosen if the user likes like so...
//In settings ...
/* Count with format 1 = YES, 0 = NO examp: 1,345 or 1345 */
$settings['count_formated']=1;
In display ...
if ($settings['count_formated']){
echo "ccount_link[$id]='".number_format($count)."';\n";
}else{
echo "ccount_link[$id]=$count;\n";
}
Just an idea to simplify this for others maybe wanting auto format ...
DC
//In settings ...
/* Count with format 1 = YES, 0 = NO examp: 1,345 or 1345 */
$settings['count_formated']=1;
In display ...
if ($settings['count_formated']){
echo "ccount_link[$id]='".number_format($count)."';\n";
}else{
echo "ccount_link[$id]=$count;\n";
}
Just an idea to simplify this for others maybe wanting auto format ...
DC
To Code Or Not To Code That Is The Question?
Was my post of any help to you? if so please do [url=http://www.clickcraft.net/slice_donations.php][b]Buy Me A Slice[/b][/url] ...
Was my post of any help to you? if so please do [url=http://www.clickcraft.net/slice_donations.php][b]Buy Me A Slice[/b][/url] ...
Re: Add comma to display counts over 3 digits?
This solution worked for me too. I think 10,171 is far better than 10171.
It would be nice to see this as a setting in a future version.
Thanks.
It would be nice to see this as a setting in a future version.
Thanks.