Hi
I'm trying to create an object orientated module. I'm running into a few problems, however. I've got a sub routine called "connect_to_db" in my module. I then call it via it's new object name. But I can't seem to do anything with it after calling.
I've posted the code, along with the error message to see if anyone can help me to discover what I'm doing wrong.
Thanks!
use WS::MySQL;
$mysql = WS::MySQL->new();
$mysql->connect_to_db;
$sth = $dbh->prepare("SELECT * FROM $DB_MYSQL_USERS WHERE user = '$user'");
ERROR MESSAGE:
Can't call method "prepare" on an undefined value
at /home/fba/staff.fbagroup.co.uk/cgi-bin/lib_quote.pl line 29.
Thanks for your help.
- wil
I'm trying to create an object orientated module. I'm running into a few problems, however. I've got a sub routine called "connect_to_db" in my module. I then call it via it's new object name. But I can't seem to do anything with it after calling.
I've posted the code, along with the error message to see if anyone can help me to discover what I'm doing wrong.
Thanks!
Code:
use lib ("/home/fba/cgi.fbagroup.co.uk/lib"); use WS::MySQL;
$mysql = WS::MySQL->new();
$mysql->connect_to_db;
$sth = $dbh->prepare("SELECT * FROM $DB_MYSQL_USERS WHERE user = '$user'");
ERROR MESSAGE:
Can't call method "prepare" on an undefined value
at /home/fba/staff.fbagroup.co.uk/cgi-bin/lib_quote.pl line 29.
Thanks for your help.
- wil