This is a discussion on INSERT Statement problem within the MySQL Database forums, part of the Database Forums category; I have financial data table in which I'm trying to insert rows with approximately 30 columns of data. I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have financial data table in which I'm trying to insert rows with
approximately 30 columns of data. I am calling a function that inserts a row for each financial transaction. There are about 120 rows that I need to insert, but only the first 30 are executing and then it stops. I am passing the data to the function using a PHP array. The array contains about 2MB worth of data. I am getting frustrated wondering why it stops executing after row 30, even when none of the column sizes are violated. I've read about 'max_allowed_packet' on mysql.com but I'm not sure if that applies. Any suggestions on other areas to look into would be greatly appreciated. Let me know if you need more specific information to help me with this. - George |
|
|||
|
Anteater Alum <futbolguy@gmail.com> wrote:
> I have financial data table in which I'm trying to insert rows with > approximately 30 columns of data. I am calling a function that inserts > a row for each financial transaction. There are about 120 rows that I > need to insert, but only the first 30 are executing and then it stops. > > I am passing the data to the function using a PHP array. The array > contains about 2MB worth of data. > > I am getting frustrated wondering why it stops executing after row 30, > even when none of the column sizes are violated. I've read about > 'max_allowed_packet' on mysql.com but I'm not sure if that applies. > > Any suggestions on other areas to look into would be greatly > appreciated. Let me know if you need more specific information to help > me with this. What error do you get, and what code do you use? -- Rik Wasmus Posted on Usenet, not any forum you might see this in. Ask Smart Questions: http://tinyurl.com/anel |
|
|||
|
function add_RAW($post, $doc_date, $dept_code, $acct_code,
$acct_title, $fund, $project, $sub, $object, $tran_id, $data_class, $type_entry, $source, $tran_descrip, $tran_ref, $approp, $expend, $encumb, $div_code, $point_entry, $seq, $loc_code, $ledg_date, $unqID) { $post = $this->changeToMySqlDate($post); $doc_date = $this->changeToMySqlDate($doc_date); $ledg_date = $this->changeToMySqlDate($ledg_date); $add_RAW = "INSERT INTO bRAW SET post_date='$post', document_date='$doc_date', dept_code='$dept_code', account_code='$acct_code', account_title='$acct_title', fund_code='$fund', project_code='$project', sub_code='$sub', object_code='$object', transaction_id='$tran_id', data_class_code='$data_class', type_entry_code='$type_entry', source_code='$source', transaction_description='$tran_descrip', transaction_ref='$tran_ref', appropriation='$approp', expenditure='$expend', encumbrance='$encumb', division_code='$div_code', point_of_entry='$point_entry', sequence='$seq', location_code='$loc_code', ledger_date='$ledg_date', unqID='$unqID'"; $this->query($add_RAW); } for ($i=0; $i<count($budget); $i+=23){ if ($bud->unqIDExists($budget[$i+23]) == "false"){ // transaction doesn't already exist $bud->add_RAW($s, $budget[$i],$budget[$i+1],$budget[$i+2], $budget[$i+3],$budget[$i+4], $budget[$i+5],$budget[$i+6],$budget[$i+7], $budget[$i+8],$budget[$i+9],$budget[$i+10],$budget[$i+11],$budget[$i +12],$budget[$i+13],$budget[$i+14],$budget[$i+15],$budget[$i+16], $budget[$i+17],$budget[$i+18],$budget[$i+19],$budget[$i+20],$budget[$i +21],$budget[$i+22],$budget[$i+23]); } else { $misE++; // counter for skipped transactions } } On Mar 9, 5:34 pm, Rik <luiheidsgoe...@hotmail.com> wrote: > Anteater Alum <futbol...@gmail.com> wrote: > > I have financial data table in which I'm trying to insert rows with > > approximately 30 columns of data. I am calling a function that inserts > > a row for each financial transaction. There are about 120 rows that I > > need to insert, but only the first 30 are executing and then it stops. > > > I am passing the data to the function using a PHP array. The array > > contains about 2MB worth of data. > > > I am getting frustrated wondering why it stops executing after row 30, > > even when none of the column sizes are violated. I've read about > > 'max_allowed_packet' on mysql.com but I'm not sure if that applies. > > > Any suggestions on other areas to look into would be greatly > > appreciated. Let me know if you need more specific information to help > > me with this. > > What error do you get, and what code do you use? > > -- > Rik Wasmus > Posted on Usenet, not any forum you might see this in. > Ask Smart Questions:http://tinyurl.com/anel |
|
|||
|
G-Rod <futbolguy@gmail.com> wrote:
> On Mar 9, 5:34 pm, Rik <luiheidsgoe...@hotmail.com> wrote: >> Anteater Alum <futbol...@gmail.com> wrote: >> > I have financial data table in which I'm trying to insert rows with >> > approximately 30 columns of data. I am calling a function that inserts >> > a row for each financial transaction. There are about 120 rows thatI >> > need to insert, but only the first 30 are executing and then it stops. >> >> > I am passing the data to the function using a PHP array. The array >> > contains about 2MB worth of data. On a side note springs to mind a lot of hosters have a 2MB upload limit. How do you get the data, and can you verifiy it's all there before you're trying to insert it. >> > I am getting frustrated wondering why it stops executing after row 30, >> > even when none of the column sizes are violated. I've read about >> > 'max_allowed_packet' on mysql.com but I'm not sure if that applies. >> >> > Any suggestions on other areas to look into would be greatly >> > appreciated. Let me know if you need more specific information to help >> > me with this. >> >> What error do you get, and what code do you use? > function add_RAW() > { > > > for ($i=0; $i<count($budget); $i+=23){ (topposting fixed) Euhm, where does this magic $buget come from? And what's the reason for this 23? Also, I asked for an error message. If you get none, please use this on top in your code: ini_set('display_errors',true); error_reporting(E_ALL); > $this->query($add_RAW); Does this object/method per chance have a method of checking wether a query succeeds, and/or what the error might be? Something along the line of: if(!$this->query($add_RAW)) echo $this->error(); And what code does '$this->query()' use actually? Seems to me a PHP issue, so crossposted & f'upped to c.l.php -- Rik Wasmus Posted on Usenet, not any forum you might see this in. Ask Smart Questions: http://tinyurl.com/anel |
![]() |
| Thread Tools | |
| Display Modes | |
|
|