I have a simple loop
include '../php_library/connect.php';
include '../php_library/opendb.php';
$conn=mysql_connect($host,$dbuser,$dbpass) or die ('Error');
mysql_select_db($dbname);
//Open the file
$fp = fopen($src,"r");
//for each line in the file
while ($row=fgetcsv($fp,10000,';')) { //Get line
$sql_insert="INSERT INTO ...";
if (!mysql_query($sql_insert,$conn)){
OutputError($sql_insert,$mysql_error());
$FailedCount++;
}
else {$InsertCount++;}
}
It works fine for the first couple of hundred or so rows but the stops -
no errors, it just stops mid-loop.
I'm guessing some sort of buffer problem (needs flushing?) but it is a
guess.
I'm running this all locally - XP, Apache2, PHP5, mySQL 4.1
Keith 2 1660
On 2005-09-06, anom <an******@hotmail.co.uk> wrote: I have a simple loop include '../php_library/connect.php'; include '../php_library/opendb.php';
$conn=mysql_connect($host,$dbuser,$dbpass) or die ('Error'); mysql_select_db($dbname); //Open the file $fp = fopen($src,"r"); //for each line in the file while ($row=fgetcsv($fp,10000,';')) { //Get line $sql_insert="INSERT INTO ..."; if (!mysql_query($sql_insert,$conn)){ OutputError($sql_insert,$mysql_error()); $FailedCount++; } else {$InsertCount++;} }
It works fine for the first couple of hundred or so rows but the stops - no errors, it just stops mid-loop.
Prepend the following to your script:
ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);
I've got a feeling you will see a message like: max execution time has
been exceeded... http://www.php.net/set_time_limit
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
Tim Van Wassenhove wrote: On 2005-09-06, anom <an******@hotmail.co.uk> wrote:
I have a simple loop include '../php_library/connect.php'; include '../php_library/opendb.php';
$conn=mysql_connect($host,$dbuser,$dbpass) or die ('Error'); mysql_select_db($dbname); //Open the file $fp = fopen($src,"r"); //for each line in the file while ($row=fgetcsv($fp,10000,';')) { //Get line $sql_insert="INSERT INTO ..."; if (!mysql_query($sql_insert,$conn)){ OutputError($sql_insert,$mysql_error()); $FailedCount++; } else {$InsertCount++;} }
It works fine for the first couple of hundred or so rows but the stops - no errors, it just stops mid-loop.
Prepend the following to your script:
ini_set('error_reporting', E_ALL); ini_set('display_errors', TRUE);
I've got a feeling you will see a message like: max execution time has been exceeded... http://www.php.net/set_time_limit
Thank you - spot on This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Frank Pryor |
last post by:
Hello,
I'd appreciate suggestions as I hash out my idea. Perhaps I'm going about
this the wrong way.
I have users using a third party windows application. They can export data
from this...
|
by: Mechphisto |
last post by:
I'm using a textarea to insert some notes into a database.
It's inserting the complete result into the mySQL table including the
linebreaks...and not as a visible symbol but an actual linebreak. If...
|
by: perplexed |
last post by:
How do you convert a user inputted date to a unix timestamp before
insterting it into your database? I have a form, with a textfield for
a date that the user inputs in the format mm-dd-yyyy and...
|
by: news |
last post by:
I'm building an e-commerce site, where the owner needs to be able to
upload a CSV file of product that gets inserted into mySQL.
Unfortunately, I think my Web host may have some functions turned...
|
by: Astra |
last post by:
Hi All
Could you please let me know how my ASP page can insert 1 row of data
containing line breaks into a MySQL DB.
To explain, I'm using ASP Classic > MyODBC 3.5x (Win) > MySQL 4 (Win) and...
|
by: FangQ |
last post by:
hi
I am very new to mysql. I have a question about using the "on duplicate
update" clause with insert command.
my table "data" has two columns, field1 and field2, where field1 is the
index...
|
by: Ajm113 |
last post by:
Ok, when I was new to this I had this problem and I bet a lot of other people did when they where new to PHP and Mysql. So this mite be your question;
"Ok, no errors or warnings in mysql and php so...
|
by: len |
last post by:
Hi All
I have started a little pet project to learn python and MySQL. The
project involves figuring out all the combinations for a 5 number
lottery and storing the data in a MySQL file.
The...
|
by: Edwin.Madari |
last post by:
-----Original Message-----
statement prepared first and executed many times with exectemany - db API http://www.python.org/dev/peps/pep-0249/
inline statemets can be exeucuted only.
hope that...
|
by: Bunty |
last post by:
I want to insert values in the database.If i insert values one by one
then it works till 4 or 5 fields then after it gives error.In my
database there are more than 20 field.Pls help me.
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |