SunQuest
           MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old May 15th, 2004, 12:57 AM
easy_coder easy_coder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 421 easy_coder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 50 m 2 sec
Reputation Power: 5
$dbh masks earlier declaration error

In one perl script I am running several SQL selects. What I have done is taken the code below and just changed the SQL selects. All the decalarations are the same for $dbh just $sql changes. The problem is that I get the follwing errors:

"my" variable $dbh masks earlier declaration
Global symbol "$dbh" requires explicit package name

I still want to use strict

How can I fix this. thanks

Code:
 # connect to DB
   my $dbh = DBI->connect ("DBI:mysql:$db:$localhost",
                           "$username","$password")
             		|| die "Could not connect to database: "
             		. DBI-> errstr;	# display error

# If time is expired then push into array
my $sql = qq{ SELECT id FROM data WHERE item= '$ref->[0]' and time_expire > '$epoch_today' };
my $sth = $dbh->prepare( $sql );
$sth->execute(); 

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > $dbh masks earlier declaration error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway