Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: (mysql) failing to locate object method

by sriraj (Initiate)
on Aug 03, 2004 at 08:56 UTC ( #379557=note: print w/replies, xml ) Need Help??


in reply to Re: (mysql) failing to locate object method
in thread (mysql) failing to locate object method

hi davorg

thanks for immediate response and here the code which i am trying

to execute,kindly help me

use DBI; # Here's how to include the DBI module my $dbh; my $db = 'myfirstdatabase'; my $db_user = 'RAM'; my $db_password = ''; # Connect to the requested server $dbh = DBI->connect ("dbi:mysql:$db","$db_user", "$db_password",{Raise +Error => 0, PrintError => 0} ) or err_trap("Cannot connect to the dat +abase"); my $sql; my $sth; $sql = "SELECT max(unxtmstmp) FROM logfl"; $sth=$dbh->prepare($sql) or die "preparing: ",$dbh->errstr; $sth->execute or die "executing: ", $dbh->errstr; @$d = $sth->fetchrow_array; print "@$d";

Replies are listed 'Best First'.
Re^3: (mysql) failing to locate object method
by beable (Friar) on Aug 03, 2004 at 10:05 UTC
    This program works for me, once I change $db, $db_user, $db_password, and $sql to something that exists on my system. Also I had to add a subroutine for err_trap(). Do you have the DBD::mysql module installed?
      hi davorge

      i installed all the modules which u had mentioned and even now when i am

      trying to install i am getting this message

      C:\>ppm

      PPM - Programmer's Package Manager version 3.1.

      Copyright (c) 2001 ActiveState SRL. All Rights Reserved.

      Entering interactive shell. Using Term::ReadLine::Stub as readline library.

      Type 'help' to get started.

      ppm> install dbi

      Note: Package 'DBI' is already installed.

      ppm> install dbd-mysql

      Note: Package 'DBD-mysql' is already installed.

      ppm>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://379557]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2023-09-29 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?