in reply to Re: Re: Re: Modifying Perl script to write to MySQL??
in thread Modifying Perl script to write to MySQL??

(cont.)

Perhaps what I'm asking is if there is a way to execute the output string going to/thru $guestbookreal to MySQL "on-the-fly?"

$guestbookreal=>mysql??

  • Comment on Re: Re: Re: Re: Modifying Perl script to write to MySQL??

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Modifying Perl script to write to MySQL??
by CountZero (Bishop) on Feb 16, 2004 at 06:41 UTC
    $guestbookreal just holds the path and name of the file where your script will store the SQL-string you need to execute later: it does not hold this SQL-string itself directly.

    So what you need to do is to open this file and read it, put its contents in a scalar variable and execute that.

    I know, I know, it seems awfully convoluted and difficult and there is for sure a much more easy other solution available, but that would involve a major rewrite of your script. Then again, any rewrite of one of Matt's script is probably a "good thing™".

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      I guess what I'm not getting a clear picture of maybe described like this:

      If the current output to the HTML page from $guestbookreal = "/home/flute/usedflutes-www/new_listings_publish.html"; (http://www.usedflutes.com/new_listings_publish.html is producing a string that I can literally copy & paste, drop into a GUI, and hit "GO" adds a new record to MySQL without any problem, then isn't there a syntax equivalent for that move - or is that not possible??

      Thanks once again for your help (and patience with me!) with this CountZero,

      -Bob
        Yes of course there is: just take the content of "/home/flute/usedflutes-www/new_listings_publish.html", put it in a scalar variable and give it to $sth=$dbh->prepare($yourscalarvariable); $sth->execute();

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law