CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI: Re: [newera] MySQL query problem: Edit Log

Veteran / Moderator

Aug 7, 2015, 7:47 AM

Views: 10353
Re: [newera] MySQL query problem

Add these 2 use statements (which should be in EVERY script) to the beginning of the script just after the shebang line.

use strict; 
use warnings;

Those pragmas will point out lots of common coding mistakes/errors.

The strict pragma will require you to declare your vars, which is done with the my keyword.

my $dbh = ....;

There are a number of problems with your code. To begin with, neither of the while loops do anything with the fetched values in the @row array, which makes them pointless.

The only thing those loops do is to repeatedly assign some variables the same value and those values have nothing to do with the fetched rows.

(This post was edited by FishMonger on Aug 7, 2015, 7:48 AM)

Edit Log:
Post edited by FishMonger (Veteran) on Aug 7, 2015, 7:48 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives