-----BEGIN PGP SIGNED MESSAGE-----
...and then Daevid Vincent said...
% > You mentioned a
% > echo "<PRE>".$sql."</PRE><P>";
% > in your first post; what do you see?
% I see exactly what I expected to see. Basically the contents of a db.sql
% file read in that looks like this roughly:
OK. That's good, and now we know, too :-) Of course, you're still using
fake examples instead of showing actual output...
% Etc.. Everything looks exactly like the .sql file does and the .sql file
% works perfectly if I redirect it in via the command line or even via an
% system() call.
OK. BTW, if you can use a system call you should be able to use the
mysqldump suggestion from another reply.
% > That's good, and we'll assume for the moment that your script doesn't
% > error through to die but instead makes a successful connection.
% Yes. All that stuff works great.
% > By the way, I see you quoting around your variables like
% > print "This is " . $var . " here" ;
% Yes, its' for readability in HomeSite. It color codes things, and that's
% a nice way to see it proper.
How interesting. Thanks for the info!
% > How does it fail? Give us more detail.
% With the error I posted earlier:
% > 1064: You have an error in your SQL syntax near ';
% > CREATE TABLE Departments (
% > DeptID int(10) unsigned NOT NULL auto_increment,' at line 4
Ah -- but you didn't post the resultant SQL statement that glued all of
this together so that we can see what line 4 is!
% It's always on the second table. Order is irrelevant.
% Notice the ";" that it chokes on. That only happens when I separate the
% CREATE commands of course. But there is no other way to deliminate them.
My guess is that Joseph's suggestion that you can only do single commands
in a php mysql() command is probably right.
% > No, that doesn't make sense. It shouldn't matter how you create and
% > populate the variable, as long as the end result content is the same.
% > Since it works when you lay it out manually, it seems very
% > probable that your filling it out in steps has some problems.
% I think I'm right ;-)
Could be :-)
% Try if for yourself and see what I mean. Just try to create a db and two
% tables and you'll see it choke.
Actually, while I do both php and mysql, I haven't yet done mysql from
php -- and so I'd be a lousy debugging source for that :-)
HTH & HAND
David T-G * There is too much animal courage in
(play) davidtg@stripped * society and not sufficient moral courage.
(work) davidtgwork@stripped -- Mary Baker Eddy, "Science and Health"
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)
-----END PGP SIGNATURE-----