Jump to content

Need help with a script.


iPixel

Recommended Posts

I need to write a script that will literally be ran just once, it's kidna like a fix i need to do in the database.

 

I have a field called filenumber which contains a number such as 002707 and many more like it.

all of them start off with zeros then the #'s. So employee # 1 would be 000001 and employee 1000 would be 001000. So you get get the idea.

 

I need to remove those initial 0's to turn 002707 into 2707, and the 001000 into 1000's.

 

here's how i invision this...

 

 

Select data from table

while results = fetch 

{

      take result[filenumber]

    use soem function to keep deleting zeros from left to right untill it hits a number other then 0.

   

    update the database row with the new filenumber. 

}

 

So i guess what i really need is a function that will allow me to parse through the filenumber string, and remove those zeros, up to a # other then 0.

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/184648-need-help-with-a-script/
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.