我在下面有这个执行一些 mysql 查询的 php 代码,基于一些逻辑,我想构建可以从 sql server 导入的普通 SQL 代码。
我怎样才能做到这一点?
谢谢你的帮助!!!
mysql_query("CREATE DATABASE IF NOT EXISTS `".$mysql_db."`"); --I don't know how with this line $q = "SHOW FULL TABLES IN ".$mysql_db; $q = mysql_query($q); if($tc==0) --//don't worry about $tc { mysql_query(" CREATE TABLE IF NOT EXISTS `tdagg` ( --And i don't know how with this `ID` int(11) NOT NULL AUTO_INCREMENT, `Pais` varchar(255) NOT NULL, `HackingInt` int(11) NOT NULL, `Date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, --timestamp can be replace by datetime PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; --//I don't understand this line "); mysql_query(" CREATE TABLE IF NOT EXISTS `tdagg_accs` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Account` varchar(11) NOT NULL, `IP` varchar(30) NOT NULL, `Hacker` varchar(40) NOT NULL, `Fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `Pais` varchar(255) NOT NULL DEFAULT 'Undefined', PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; "); }else { mysql_query(" ALTER TABLE `tdagg_accs` ADD `Pais` varchar(255) NOT NULL DEFAULT 'Undefined' "); }