mysql query and maximum characters in sql statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I have written a program which imports the tab delimited file and insert all
the line from file to the mysql line by line.
I am succeding in the above case. but problem with the above method is its
taking to too much time while inserting into the database.
The file's size will be more than 5000 lines.

Then i tried to build a string of ; seperated queries. as follows

for($i=1; $i<sizeof($array); $i++){
   $insert_string .= "insert into tablename (v1, v2..... v6)
values('$array[$i][1]', '$array[$i][2]'..... '$array[$i][6]');";
}
if(!empty($insert_string)){
mysql_query($insert_string, $conn) or die("query failed : ".mysql_errror());
}

Its throwing error saying check the manual for right syntax.....

After investigating in some sites i come to know that its problem of
limitations in query size.

I also tried with "SET GLOBAL max_allowed_packet=30000000;"
Then also its throwing the same error.

Can anybody tell me how to fix this error and reduce the inserting time with
a single statement instead of writing more insert statements

-- 
Regards,
Sanjeev
http://www.sanchanworld.com
http://webdirectory.sanchanworld.com - submit your site

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux