Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBI - move to start of record-set?

Status
Not open for further replies.

Gooner

Programmer
Jan 31, 2001
13
GB
I am trying to pick up records from a mySQL database. It works fine unless there is just one record, it will not do anything. I think I need a jump 'Begining of File' command (if it exists!) as my original 'fetchrow_hashref' moves onto the only record, can anyone help please?
------------------------------------------------------------
if(my $ref = $sth->fetchrow_hashref())
{
open(TEXTFILE, ">$username.txt");
while(my $ref = $sth->fetchrow_hashref())
{
print TEXTFILE "$ref->{'record'}";
print TEXTFILE "$ref->{'reference'}";
}
close(TEXTFILE);
}
else
{
print "No entries in DB";
}
------------------------------------------------------------
Thanks for your time and trouble.
 
Hi Gooner - how did you solve your problem? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top