Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
That was what @{$hr_output}{@fields} was supposed to catch....it gives you the values of the hash in the order of @fields.
You don't have to follow the exact same order as the fields are defined in the table, but you will have to follow the same order you specified in the INSERT-query, which is why I used @fields a lot at that point.
Also, it seems I made a slight mistake for the last_insert_id-select. It should be<br? my $sth_select_last_insert_id = $dbh->prepare( qq( SELECT LAST_INSERT_ID() )); (Note the added ()).
The other errors are all a result of this. First the query fails (syntax error), which results in an undef result.
But when executing it (at my $article_id = ($dbh->selectcol_arrayref($sth_select_last_insert_id))->[0]; I immediately dereference it. But undef is not an arrayref, so that won't do (and perl complains about that).
Then when trying to insert the undef (which is NULL when stored in a database) in the article_event_index table, an error occurs, which leaves $inserted_records containing undef. When comparing that to a value, perl warns (but proceeds anyway) about that.

In reply to Re^8: Relational table with perl DBI by Neighbour
in thread Relational table with perl DBI by M15U

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-25 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found