On Sun, 6 Jan 2002, nafiseh saberi wrote:
> hi dear team.
> hope you be fine.
i be
>
> I work with perl for write database with DBI .
> can you help me for write that code ?
>
> I connect and insert but how fetch ?
here's an example on fetching info from a mysql db
i believe you are using postgresql, but this should help you anyway
=============================================================
my $trafficpermonthhour= "select * from trafficperhour where time= $time;";
$sth = $dbh->prepare($trafficpermonthhour);
my $rc = $sth->execute() || print "unable to execute $sth $!";
while ( my $row = $sth->fetchrow_hashref )
{
$Bytes_In=$row->{bytes_in};
$Bytes_Out=$row->{bytes_out};
$Msgs_In=$row->{msgs_in};
$Msgs_Out=$row->{msgs_out};
}
=============================================================
first i set my query into a scalar then i prepare the scalar then execute it
and print an error message if there is a problem executing.
there are several ways to handle the info you get back from your query. here i
use fetchrow_hashref. read the DBI docs for other ways
>
> thx for your time.
> ________________________________
> Sincerely yours Nafiseh Saberi
>
> People will forget what you said ...
> People will forget what you did...
> But people will Never Forget
> how you made them feel.
>
> < Any suggestion are welcome to me >
> __________________________________
>
--
- josh
N8MSO
20A8 2FC6 9099 D215 78F4 D005 B9F3 21C4 300C C25E ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [EMAIL PROTECTED] - tel: +972.58.520.636, http://www.tkos.co.il
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]