-1
我有.txt文件中的数据。从txt文件插入数据到数据库PHP
4654664
6545645646
54564121452
564754412
5456545
我想用PHP
<?php
$host= "localhost";
$user= "infdgfg";
$pass= "98fgfgdghf6";
$db="xxxxx";
$connect= mysql_connect($host,$user,$pass);
if (!$connect)die ("Cannot connect!");
mysql_select_db($db, $connect);
$file = fopen("oxxxkxxn.txt","r");
while(! feof($file))
{
$sql = "INSERT INTO xxxxx(xxxxx) VALUES ('($file)')"; //Insert every read line from txt to mysql database
mysql_query($sql);
}
fclose($file);
?>
插入数据库中的这些数据,但是这是行不通的。
(Resource id #4)
(Resource id #4)
(Resource id #4)
此错误。
只是一个友情提示,您可能需要阅读过此页:[该如何对询问指南(https://开头stackoverflow.com/help/how-to-ask),因此您始终可以确定您的问题很容易回答并尽可能清晰。一定要包括你为解决你遇到的问题所做的任何努力,以及当你尝试修复这些问题时发生了什么。另外不要忘记你的显示代码和任何错误信息! –
请努力正确格式化您的代码。另外,你说'这个错误',但你不列出错误?我们应该如何帮助解决这个错误? –