Professional Web Applications Themes

INSERT Statement problem - MySQL

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

  1. #1

    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

    Anteater Guest

  2. #2

    Default Re: INSERT Statement problem

    Anteater Alum <com> wrote:
     

    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
    Rik Guest

  3. #3

    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,
    $enb, $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',
    doent_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', enbrance='$enb',
    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 <com> wrote: 



    >
    > 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[/ref]


    G-Rod Guest

  4. #4

    Default Re: INSERT Statement problem

    G-Rod <com> wrote: 
    >> [/ref][/ref]

    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.
     
    >> 
    >>
    >> What error do you get, and what code do you use?[/ref][/ref]
     

    (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);
     

    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
    Rik Guest

Similar Threads

  1. Question Insert from ASP to SQL using recordset data as values in insert statement
    By JasonM in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 13th, 05:54 PM
  2. problem with insert statement
    By sviolet in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: June 23rd, 01:39 AM
  3. Replies: 3
    Last Post: September 30th, 09:24 PM
  4. Replies: 4
    Last Post: September 16th, 04:54 PM
  5. Problem with IDENTITY and ORDER BY in a INSERT statement
    By Steve Kass in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 2nd, 06:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139