データベース管理コードが無効である理由を理解してください
<?php<br /> $dbcon = mysql_connect("localhost","××××","×××××");<br /> if(!$dbcon)<br /> {<br /> die('could not connect: ' . mysql_error());<br /> }<br /> echo "mysql connected\n";<br /> mysql_query("CREATE DATABASE soap_calc",$dbcon);<br /> mysql_select_db("soap_calc",$dbcon);<br /> $sql = "CREATE TABLE oils<br /> (<br /> ID int NOT NULL AUTO_INCREMENT,<br /> CN_Name varchar(15),<br /> EN_Name varchar(30),<br /> SAP decimal(5,3),<br /> SAP_NaOH decimal(5,3),<br /> Non_Sapon decimal(5,3),<br /> Iodine decimal(10,3),<br /> PRIMARY KEY (ID)<br /> )";<br /> mysql_query($sql,$dbcon);<br /> <br /> //read items from file<br /> $file = fopen("oiltable", "r");<br /> while(!feof($file))<br /> {<br /> fscanf($file,"%s %s %s %s %s \n",$CNN,$ENN,$NAOH,$KOH,$INS);<br /> mysql_query("INSERT INTO oils (CN_Name,EN_Name,SAP,SAP_NaOH)<br /> VALUES ('$CNN','$ENN','$KOH','$NAOH')");<br /> }<br /> mysql_close($dbcon);<br /> echo "db finished\n";<br /> ?>