> 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:
CREATE TABLE table1 (
CREATE TABLE table2 (
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
> 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 = <<<SQL
> % CREATE TABLE Schedule (
> % SQL;
> % It "works". However I'm dreading doing this one table at a
> time. Grr.
> 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 ;-)
Try if for yourself and see what I mean. Just try to create a db and two
tables and you'll see it choke.