I'm probably crazy for even trying this but I'm trying to make a script
that will iterate through my databases, iterate through all the tables,
and show everything on one page in forms that allow me to change the
data when I hit the submit button. Blogs are displayed as links to
image.php?id=$id along with browse buttons so new images can be
uploaded. The idea is to make an idiot proof way for artists to change
their web databases without having to use phpadmin.
Its not that hard when all the tables have ids that are the same. I
simply find the highest id from the first table, then iterate through
the ids and call each table for every id.
$sql="select * from $table where id=$id";
Some of these art graphics are quite large, so I wanted to break them up
for easier downloading. The trouble started when I broke the blobs up
into 64k parts and gave each blob a master id.
for example:
imagemeta image
id=1 id=1 masterid=1
id=2 masterid=1
id=3 masterid=1
id=2 id=4 masterid=2
id=5 masterid=2
This is how it was done at
http://php.dreamwerx.net/forums/viewtopic.php?t=6
However, it seems kind of crazy to me because the image ids have nothing
to do with the imagemeta ids; I can't just iterate through the ids and
assume that all the data in each id corresponds to data in other tables
with the same id.
So I tried it like this:
imagemeta image
id=1 id=1 part=1
id=1 part=2
id=1 part=3
id=2 id=2 part=4
id=2 part=4
This seems crazy too, because you end up with multiple ids with the same
number in the image table.
Either way, it gets pretty complicated. Is there any preferred,
definitive way this should be done ?
Right now I'm working on doing it the first way (above). But here's the
complicate way I have to do it: first,I iterate through the masterids in
the first image table, learn which ids it holds and then iterate through
the other tables while checking to see if each table has a master id. If
it does, I use the master id to call up the image. if it doesn't I use
the ids I found in the first table to call up the metadata.
I can't help thinking there must be a better way. If nothing else, this
has taught me to think in mysqlese.
thanks.