otonomi Posted September 29, 2009 Share Posted September 29, 2009 Hi all, i have a problem with the following: Whenever i try to insert more then 1024 records into an access database to insert query stops at 1024. So if i get my result i see that only 1024 records are inserted. I have no idea how this comes, can anyone help me? this is the code: <?php ob_start(); include 'connect/connect.php'; $iEmailsNotInserted=0; $sEmailNotInserted=""; $new_key=""; $iAantal=0; $listarray = array(); $txtBulkEmail = $_POST['txtBulkEmail']; $txtList = $_POST['txtList']; function createKey($amount) { $keyset = "abcdefghijklmnopqrstuvwxyzZ0123456789"; $randkey = ""; for ($i=0; $i<$amount; $i++) { $randkey .= substr($keyset, rand(0,strlen($keyset)-1), 1); } return $randkey; } //seperate emails and insert each email in database $listarray= explode(";",$txtBulkEmail); reset($listarray); //remove duplicates from listarray $clean_listarray = array_unique($listarray); $aantal_in_clean_array = count($clean_listarray)-1; echo "aantal: " . $aantal_in_clean_array; //put all excisting subscribers in an array $i=0; $arrayAll = array(); $sqlALL ="SELECT ls_email FROM $txtList"; $queryALL = odbc_exec($conn, $sqlALL); while(odbc_fetch_row($queryALL)) { $sfound_email = odbc_result($queryALL, "ls_email"); $trim_arrayAll[$i]= trim($sfound_email); $i++; } $aantal_in_all_array=count($trim_arrayAll)-1; for ($iFirstloop = 0; $iFirstloop<=$aantal_in_clean_array; $iFirstloop++) { //$matchgevonden telkens resetten $matchgevonden = "no"; $trim_clean_listarray[$iFirstloop] =trim($clean_listarray[$iFirstloop]); //check if new mail allready exists in arrayall for ($iSecondLoop = 0; $iSecondLoop <= $aantal_in_all_array;$iSecondLoop++) { //echo "mailingevoegd: " . $trim_clean_listarray[$iFirstloop] . " mail database: " . $trim_arrayAll[$iSecondLoop] . "<br>"; if( $trim_clean_listarray[$iFirstloop]== $trim_arrayAll[$iSecondLoop]) { $matchgevonden = "yes"; $iEmailsNotInserted++; if ($iEmailsNotInserted<=20) { $sEmailNotInserted=$sEmailNotInserted . $trim_clean_listarray[$iFirstloop] ."_"; } } } if ($matchgevonden!="yes") { //er is geen match gevonden if ($trim_clean_listarray[$iFirstloop]!="") { $new_key = createKey( . "-" . createKey(4) . "-" . createKey(4) . "-" . createKey(4) . "-" . createKey(12); //de subscriber toevoegen $SQL_insert="INSERT INTO $txtList (ls_id,ls_email,ls_unsubscribed) VALUES ('$new_key','$trim_clean_listarray[$iFirstloop]','0')"; echo $SQL_insert . "<br>"; $resultupdate= odbc_exec($conn,$SQL_insert); } } } odbc_close($conn); //header("Location:index.php?list=" . $txtList . "&action=insertall¬inserted=$iEmailsNotInserted¬insertedm=$sEmailNotInserted"); ob_end_flush(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/175932-php-and-odbc-and-access-database/ Share on other sites More sharing options...
RussellReal Posted September 29, 2009 Share Posted September 29, 2009 what script ever could warrant inserting 1024 RECORDS in 1 query? :S or do you mean you can't loop and insert more than 1024 records? in this case it is more likely that your php script is timing out set_time_limit Quote Link to comment https://forums.phpfreaks.com/topic/175932-php-and-odbc-and-access-database/#findComment-927212 Share on other sites More sharing options...
lemmin Posted September 29, 2009 Share Posted September 29, 2009 Try echoing the last error message with odbc_errormsg() to see if there is a limitation on the mdb you are using. http://us3.php.net/manual/en/function.odbc-errormsg.php Quote Link to comment https://forums.phpfreaks.com/topic/175932-php-and-odbc-and-access-database/#findComment-927247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.