<?php // Comment $DB_NAME = '762775_aboutthis'; $COUNTER_BYTE_SIZE = 4; $LEN_LONG_URL = 10; echo <<<EOT <!doctype html><html><body><pre> USE $DB_NAME; CREATE Table Test ( # Comment TestID int($COUNTER_BYTE_SIZE) unsigned NOT NULL auto_increment PRIMARY KEY, Second varchar($LEN_LONG_URL) NOT NULL ) ENGINE = InnoDB, COMMENT = 'Test table'; </pre></body></html> EOT; ?>
This generates the following MySQL code that I can copy/paste right into phpMyAdmin:
USE 762775_aboutthis; CREATE Table Test ( # Comment TestID int(4) unsigned NOT NULL auto_increment PRIMARY KEY, Second varchar(10) NOT NULL ) ENGINE = InnoDB, COMMENT = 'Test table';
Simplistic, but I'm happy. (I didn't use actual PHP constants because they won't expand in a heredoc.) I guess I could use MySQL's user-defined variables, but they seem a bit kludgy, and don't seem to mentally "parse" as easily as this approach.