Author Topic: Scan PHP script to help generate sql database  (Read 395 times)

0 Members and 1 Guest are viewing this topic.

Offline GuyzerTopic starter

  • Irregular
  • Posts: 14
    • View Profile
Scan PHP script to help generate sql database
« on: December 15, 2008, 11:02:14 PM »
I had a website I made quite awhile ago, written in PHP and when I backed it up, I didn't export my database to a text file or anything. :-\ Now I'm sure I could pick through each script and be able to re-build my database tables however this will take a while and I could possible miss or misspell information and could be a long task to get the database structure back in order. And of course I didn't document the database structure in my scripts.

Now my question, is there a program out there that could scan all the scripts and generate the tables and field names to help me build the new database. I'm sure I could populate the database when I can get the structure.

I know this all my fault and if I spend another 30 second and exported the database I would be running my website by now. Any help would great! Thanks for your help!

Guyzer

Online GingerRobot

  • Guru
  • Fanatic
  • *
  • Posts: 4,133
  • Gender: Male
  • Call me Ben
    • View Profile
Re: Scan PHP script to help generate sql database
« Reply #1 on: December 16, 2008, 03:04:46 AM »
Not that i'm aware of. Moreover, it might not be possible. For example, if you had a query with a join and didn't explicitly declare which tables the columns in the result set were coming from, you wouldn't know which table to put them in.

Also, how would you decide the types, collations, lengths etc of each field type from a bunch of SELECT/INSERT and DELETE queries?

Offline GuyzerTopic starter

  • Irregular
  • Posts: 14
    • View Profile
Re: Scan PHP script to help generate sql database
« Reply #2 on: December 16, 2008, 10:35:12 PM »
Ya, you make a good point. I figured I would have to pick through the scripts on my own to build the data base. Thanks for your input!

Guyzer!