Possible Memory Problems, Win95/php3
| From: | Kenneth Bogucki | Date: | Sun, 13 Aug 2000 01:45:14 +0000 |
| Subject: | Possible Memory Problems, Win95/php3 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11490@lists.php.net to get a copy of this message | ||
Simply, I have an old dos database, dbf format, that I keep the records
I have to upload to mysql at my web site. Since php3 supports a limited
number of functions that can open and read dbf files, I decided to write
a quick script to pull the records for the dbf file and format them to
upload to the site. The problem is the database has about 52000 records
and the script below will stop writing after it reaches record 10261 or
so, it varies some with each try...60 records plus or minus.
I changed the php3 ini file to allow for more memory, no help
I double checked the database to make sure the files are not corupted.
I checked the docs
I re-wrote the script
If it's a memory problem and I change the memory variable in the ini
file there should be a increase in the number of records send to file,
there isn't an increase.
I'm out of ideas.
something is wrong...I suspect it's a memory problem, I'm not sure. Any
idea, is there something built into php re: the dbf function not
documented.
Any help appreciated.
$fd = fopen("c:\\uploads\\db.php3", "a");
$prefix = "MySQL(\$dbName,\"INSERT INTO general VALUES('";
$suffix = "')\");";
$s = "','";
$db = dbase_open("d.dbf", 2);
$num = dbase_numrecords($db);
$fields = dbase_numfields($db);
for ($index=1; $index <= $num; $index++){
$record=dbase_get_record($db, $index);
fputs($fd, $prefix.trim(addslashes($record[0])).$s);
fputs($fd, trim(addslashes($record[1])).$s);
fputs($fd, trim(addslashes($record[2])).$s);
fputs($fd, trim(addslashes($record[3])).$suffix."\n");
Print ("Records..$num...$index\n");
}
dbase_close($db);
fclose($fd);