Hello, I'm having a problem implementing a script that creates database tables. I can create basic tables, but I need to define the specific engine type and autoincrement numbers. For example: ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 Normally, when I run an SQL script, I'd just add the above after the close of the table creation ")". However, when I put this into a php script and attempt to execute it, it won't let me. My question is: Are there specific PHP commands that I need to use in order to execute those table modifications? Or, should I just be able to put the above on the end and it should run? (ie. the problem is elsewhere). Thanks in advance for any help! I'd greatly appreciate it!!!
Yes. You put the query in the mysql_query function. You have to be connected to mysql through php and have the database selected though. mysql_connect(HOST, USERNAME, PASSWORD) or die(mysql_error()); mysql_select_db(DBNAME) or die(mysql_error()); mysql_query("CREATE TABLE test (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY); ENGINE=MYISAM; AUTO_INCREMENT=2; DEFAULT CHARSET=utf8;") or die(mysql_error()); PHP: