in reply to How do I write data in SQLite
Since you know it's on the alert line, you know that the problematic variable is $_ (the current element of @links), or $text[$v]. You know it's not $a or $v because you set them explicitly before the loop starts.
Use some print statements on separate lines for each of those variables to see what they contain. When you try to print the one that's uninitialized, you'll get the error message again and you'll know which one is causing the problem.
What to do after you find the problematic variable depends on your needs. You could just initialize them all to "" at the beginning of the loop and that would make the error message go away, but you might not want any of those fields to be blank.
Here's another method
while(@links) { $_ ||= ""; $text[$v] ||= ""; $dbh->do( "INSERT INTO webpages_data VALUES('$a', '$_', '$text[$v] +', NULL)"); $a++; $v++; }
||= says, for example: if ( ! $text[$v] ) { $text[$v] = "" };
-- -- GhodMode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I write data in SQLite
by chromatic (Archbishop) on Feb 04, 2006 at 03:56 UTC | |
|
Re^2: How do I write data in SQLite
by lampros21_7 (Scribe) on Feb 04, 2006 at 00:58 UTC |