dennismonsewicz Posted March 22, 2010 Share Posted March 22, 2010 I am trying to load a text file that contains a create table script but keep getting a weird error. function create_tbl($file) { $report = mysql_query($file)or die(mysql_error()); if(!mysql_error()) { return TRUE; } else { return FALSE; } } $create_file = readfile($xml->create->name); create_tbl($create_file) Text File contents CREATE TABLE coxdeductible ( rowid int(11) NOT NULL AUTO_INCREMENT, make varchar(400) NOT NULL, model varchar(400) NOT NULL, deductible varchar(255) NOT NULL, published int(1) NOT NULL, PRIMARY KEY (rowid) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11; I keep getting this error: CREATE TABLE coxdeductible ( rowid int(11) NOT NULL AUTO_INCREMENT, make varchar(400) NOT NULL, model varchar(400) NOT NULL, deductible varchar(255) NOT NULL, published int(1) NOT NULL, PRIMARY KEY (rowid) )You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '207' at line 1 Quote Link to comment Share on other sites More sharing options...
TeddyKiller Posted March 22, 2010 Share Posted March 22, 2010 This is SQL Help. Go into your PHPMyAdmin and insert that SQL (text file contents) If it gives an error then its SQL help and this isn't the right place to post. I'm assuming "ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11;" gives the error. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 22, 2010 Author Share Posted March 22, 2010 I just inserted this statement into my phpmyadmin and everything worked... I figured I would post this in the PHP Help since I am trying to load the SQL statement from a .txt file first Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 22, 2010 Author Share Posted March 22, 2010 I solved my problem... I used the function file_get_contents and it works perfectly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.