-----BEGIN PGP SIGNED MESSAGE-----
...and then Daevid Vincent said...
% Thanks for the reply Bill, however this did not solve the problem. I
% still receive the same error with your method as well.
% 1064: You have an error in your SQL syntax near ';
% CREATE TABLE Departments (
% DeptID int(10) unsigned NOT NULL auto_increment,' at line 4
You mentioned a
in your first post; what do you see?
% > Are you first creating a new database first with mysql_create_db()
% > before trying to run your schema? What error message do you get? The
% > code you've posted is only creating a table.
% Yes. I am:
% $V2DB = "V2_SL".$CompanyID;
% $result = mysql_create_db($V2DB, $linkI);
% mysql_select_db ($V2DB, $linkI) or die ("Could not select ".$V2DB."
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.
By the way, I see you quoting around your variables like
print "This is " . $var . " here" ;
and should note that that's way much extra work. I just tested (to be
sure ;-) and
$v = "variable" ;
print "print : this includes $v right here<br>\n" ;
echo "echo : this includes $v right here<br>\n" ;
print "print : this quotes " . $v . " for me<br>\n" ;
echo "echo : this quotes " . $v . " for me<br>\n" ;
die ("die : This is $v for you<br>\n") ;
happily gives me
print : this includes variable right here
echo : this includes variable right here
print : this quotes variable for me
echo : this quotes variable for me
die : This is variable for you
as it oughta. But I digress...
% > heredoc syntax,
% > which would let you do something like
% > $sql = <<<SQL
% Thanks for that tip, however it fails the same as opening the file and
% same as "$sql .="
How does it fail? Give us more detail.
% > (hopefully $linkI is your mysql connection) This way you
% > don't have to bother with all that quoting.
% Yes, $linkI is my connection identifier.
% 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 (
% 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.
Show us what you get when you print your $sql statement so that we can
debug actual practice rather than theory ;-)
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-----