|
Posted by Carl Pearson on 01/16/07 23:13
Lorenzo Bettini wrote:
> Carl Pearson wrote:
> the generated php code I have in mind would be used, e.g., in an
> installation procedure to generate (or, more interestingly, update) the
> tables of the database.
Ultimately it's just a bunch of calls to mysql_query().
You could use phpMyAdmin to dump your existing structure into a file,
incorporating it into your install script, using your text editor's
search & replace capabilities to wrangle the dump into shape. A chore,
but still you'd only have to do it once, and having a dump would save
you from having to type all those table defs by hand.
For updates, are you talking about the data, or the structure?
If data, just create the appropriate queries and have your script turn
the results into insert statements (don't run them on the same database,
just use PHP to add the "INSERT INTO" & other code before it echo's or
prints anything out...), saving that as a file. Am presuming here you'd
run the queries on one machine and the resulting file on another.
For structure, you really shouldn't be changing that too much once the
database is up & running, so that would just be another bunch of
statements that you'd design ahead of time, stuffing them all into a
script similar to the structure generation method above.
Good luck!
--
Carl
[Back to original message]
|