This topic is locked

Help with MYSQL Code

6/18/2008 12:16:12 PM
PHPRunner General questions
S
swanside author

Hello.
This is abit off topic, but maybe somebody can help me.
I have a field called Job_No and a field called File_No
In the old ms access database the users started to put the file number in the job number filed, so it should be like this
Job_No are 10000000, 10000001, 10000002 and so on

File No are AH 1234, FC 1234, ED 1234
But its like this

Job_No 10000000, 10000001, Ah 1234 100000002, FC 3334
Because of this, I can not set the job_no to auto increment, so its either delete all the info in the database which has the fileds wrong or move al the wrong fields into the correct fields.

Is there a way of doing this easy, or not?????
Thanks

Paul

A
alang 6/18/2008

You should be able to do this with a bit of PHP code without too much drama as long as you can define rules for what goes where and from what you have said you should be able to do this. Suggest:

  • scan all the records
  • get the existing field
  • use split function to break on space character
  • use string length and number of pieces to determine whether the info should be job_no or file_no
  • update new fields as appropriate

S
swanside author 6/19/2008

You should be able to do this with a bit of PHP code without too much drama as long as you can define rules for what goes where and from what you have said you should be able to do this. Suggest:


  • scan all the records
  • get the existing field
  • use split function to break on space character
  • use string length and number of pieces to determine whether the info should be job_no or file_no
  • update new fields as appropriate


Tanks Alan.
WHat I ended up doing is opening up the exsiting database in MSAccess, and sorted the lines by the fields.
I then deleted all the ones in the wrong colums as they are about 4 years old and I doubt we are going to be questioned on these jobs now then imported it into mysql database.
I made a copy of the exsiting MSAccess database anyway, so I can go back to it.
Thanks

Paul.