MySQL query is giving the error but it seems to me that table name in data_new
only and columns are same as written
This is the SQL Error:
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 '0573','cate-csir','NKN')' at line 1"
<?php
$fm = fopen('main.txt','r');
@mysql_connect('localhost','root','');
@mysql_select_db('username');
$count=0;
while ($line = fgets($fm)) {
$new_data=@split(':',$line);
$query="INSERT INTO `data_new` (`directory`,`machineip`,`description`,`state`,`status`,`instituteid`,`category`,`project`) VALUES ('$new_data[0]','$new_data[1]','$new_data[2]','$new_data[3]','$new_data[4],'$new_data[5]','$new_data[6]','$new_data[7]')";
}
$result=@mysql_query($query);
if(!$result){
die(mysql_error());
}
fclose($fm);
?>