mardi 27 octobre 2015

How to use textfile to create SQL table entries?

I have a text file that looks like this:

WPG GRIFFON, WIREHAIRED 
AFG HOUND, AFGHAN 
IBI HOUND, IBIZAN 
WOF HOUND, IRISH WOLF 
OTT HOUND, OTTER 
PHA HOUND, PHAROAH 
DER HOUND, SCOTTISH DEER 
JIN JINDO 
...

and I am trying to rewrite this line of code so it says the names of the dogs

$link = mysqli_connect($servername, $username, $password, $db) or die(mysqli_error($link));

mysqli_query($link, "CREATE TABLE IF NOT EXISTS `description` (`descID` int(10) NOT NULL AUTO_INCREMENT, `desc` text NOT NULL, PRIMARY KEY (`descID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");

However, I always get an error and it crashes the webpage.




Aucun commentaire:

Enregistrer un commentaire