Jump to content

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

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.