You have a couple of issues that once fixed will probably help you find the problem (or fix the problem. You arn't chomping the lines so you will have '5\n' instead of just '5' which is probably messing up the query. You are also using a C style loop instead of more perlish way that will require less variables ;) So here is your code with some minor changes that shouldn't break anything:

#!/usr/bin/perl use warnings; use strict; use DBIx::Simple; my $db = DBIx::Simple->connect('dbi:SQLite:dbname=mydatabase.db') or die DBIx::Simple->error; #switch to 3 arg form, no advantage here but its a good habit ;) open (WEBPAGESFORALL, "<", "webpages.txt") || die "couldn't open the f +ile!"; my @webpages = <WEBPAGESFORALL>; close(WEBPAGESFORALL); #remove trailing newlines chomp(@webpages); my @webpages_for_files; #print out the id's of the pages we want, seperated by commas print join(",", @webpages); #loop over the indexs we just grabbed from the file for (@webpages) { #push this page onto our list of saved pages. push @webpages_for_files, $db->query("SELECT webpage FROM webpages_d +ata WHERE id = ?", $_)->list; #change the query to use place holders } print join(",", @webpages_for_files); #three arg form open (WEBPAGES_OUT,">", "giveit.txt") || die "couldn't open the file!" +; foreach my $webp (@webpages_for_files) { print $webp ."\n"; } close(WEBPAGES_OUT);

___________
Eric Hodges

In reply to Re: Script won't retrieve data from database by eric256
in thread Script won't retrieve data from database by lampros21_7

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.