Hi Moritz, Infact its partially working... Actually i am trying to transfer the data twice to the sql... my code is something like this:
if(condition1){ @words = split(/=/, $_); print "$_"; $sth->execute($words[0],$words[1]) or die $DBI::errstr; } if(condition2){ @words = split(/=/, $_); print "$_"; $sth->execute($words[0],$words[1]) or die $DBI::errstr;}
For the condition1 its working fine.. But as soon as i try with condition2 it shows some error abt missing curl bracket in some other loop. But if i try to use $_, $_ in second condition its works fine. Dont knw wats the problem is..
if(condition1){ @words = split(/=/, $_); print "$_"; $sth->execute($words[0],$words[1]) or die $DBI::errstr; } if(condition2){ @words = split(/=/, $_); print "$_"; $sth->execute($_,$_) or die $DBI::errstr;}
Infact if i use $words[0], $_. Then also it does not show any error. But as soon as I try with $words[0], $words1, it starts showing the error..
DBD::mysql::st execute failed: Column 'name' cannot be null at ./fsm0. +pl line 110, <> line 170. Column 'name' cannot be null at ./fsm0.pl line 110, <> line 170.
Thanking you,

In reply to Re^4: split a line into 2 variables and store in SQL by sharan
in thread split a line into 2 variables and store in SQL by sharan

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.