INSERT Statement problem

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-10-2007
Anteater Alum
 
Posts: n/a
Default INSERT Statement problem

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

Reply With Quote
  #2 (permalink)  
Old 03-10-2007
Rik
 
Posts: n/a
Default Re: INSERT Statement problem

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
Reply With Quote
  #3 (permalink)  
Old 03-10-2007
G-Rod
 
Posts: n/a
Default Re: INSERT Statement problem

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



Reply With Quote
  #4 (permalink)  
Old 03-10-2007
Rik
 
Posts: n/a
Default Re: INSERT Statement problem

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:33 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0