<?php$dbcon = mysql_connect("localhost","××××","×××××");if(!$dbcon){ die('could not connect: ' . mysql_error());}echo "mysql connected\n";mysql_query("CREATE DATABASE soap_calc",$dbcon);mysql_select_db("soap_calc",$dbcon);$sql = "CREATE TABLE oils(ID int NOT NULL AUTO_INCREMENT,CN_Name varchar(15),EN_Name varchar(30),SAP decimal(5,3),SAP_NaOH decimal(5,3),Non_Sapon decimal(5,3),Iodine decimal(10,3),PRIMARY KEY (ID))";mysql_query($sql,$dbcon);//read items from file$file = fopen("oiltable", "r");while(!feof($file)){ fscanf($file,"%s %s %s %s %s \n",$CNN,$ENN,$NAOH,$KOH,$INS); mysql_query("INSERT INTO oils (CN_Name,EN_Name,SAP,SAP_NaOH) VALUES ('$CNN','$ENN','$KOH','$NAOH')");}mysql_close($dbcon);echo "db finished\n";?>
[code=php]print_r(mysql_query("CREATE DATABASE soap_calc",$dbcon));[/coder]
看看是不是有错
print_r(mysql_query("CREATE DATABASE soap_calc",$dbcon));[/coder]看看是不是有错
print_r(mysql_query("CREATE DATABASE soap_calc",$dbcon));[/coder]看看是不是有错
mysql_query("CREATE DATABASE soap_calc",$dbcon) or die(mysql_error());
看看,估计是没有权限
mysql_query("CREATE DATABASE soap_calc",$dbcon) or die(mysql_error());
看看,估计是没有权限
的确是权限的问题
我用来登录的用户只有usage权限
刚开始接触php和mysql很多问题都不熟悉,
多谢:)