in reply to Re^3: split a line into 2 variables and store in SQL
in thread split a line into 2 variables and store in SQL

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,

Replies are listed 'Best First'.
Re^5: split a line into 2 variables and store in SQL
by moritz (Cardinal) on Jan 25, 2009 at 18:56 UTC
    And which one is line 110 in your script now?