From: Daevid Vincent Date: December 17 2002 12:32pm Subject: RE: How can I duplicate a mysql template database? List-Archive: http://lists.mysql.com/mysql/127681 Message-Id: <002d01c2a5c8$6e835c20$0201a8c0@telecom> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > You mentioned a > echo "
".$sql."
";
> 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:
CREATE TABLE table1 (
blah int(10),
foo char(5)
);
CREATE TABLE table2 (
blee int(10),
fee char(5)
);
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.
> 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 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
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.
> % I just have an awful feeling that PHP/mySQL won't let me
> stack commands
> % like that because if I just do one table, like this:
> %
> % $sql = <<