Jump to content

[SOLVED] Concatenate Zero's


wintallo

Recommended Posts

Hey, I was wondering how I could concatenate zeros at the beginning of a integer. For example, I would want all variables to have 8 digits so I concatenate. 8 zeros in front of 5 (00000005), 5 zeros in front of 4536 (000004536), etc. I would do this so that when I'm ordering a mySQL database by a field called "score" that it orders correctly. If I don't do this it orders 34880 after 120661. I would want it to automatically calculate how many zeros it would need to concatenate at the beginning of a number.  Thanks for reading.

Joel
[email protected]
Link to comment
https://forums.phpfreaks.com/topic/27051-solved-concatenate-zeros/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.