You still haven't given enough details to understand what you are trying to do.
I'm not sure, but I don't think (licence/copyright wise) you are allowed to pull out parts of the GT library to use in your own scripts. Someone from GT will be able to advise you better.
Try something like -
###assign the UserID from your external script
my $UserID = "$user_id_value";
###set your database details
my @db_connect = ("DBI:mysql:database_name", "user_name", "password");
###connect to the DBMan SQL database
$DBH = DBI->connect (@db_connect) or die ("Content-type: text/html\n\n Could Not Connect");
###do your query
$query = qq!
SELECT session_id
FROM Sample_Users_Sessions
WHERE session_user_id = $UserID
!;
my $sth = $DBH->prepare ($query) or die ("Content-type: text/html\n\n Could Not Prepare");
$sth->execute or die ("Content-type: text/html\n\n Could Not Execute");
###do somthing with what you find
if ($sth->rows) {
#Do something here
$sth->finish;
# Disconnect
$DBH->disconnect();
exit;
}
else {
#do something else
$sth->finish;
# Disconnect
$DBH->disconnect();
}
You need to replace the red parts with your own values.
As I said before, this seems to be a Perl/MySQL question.
Simon.
Quote:
I want to use library GT in the my scripts? Quote:
To make inquiry to table Sample_Users_Sessions and to receive session_user_id###assign the UserID from your external script
my $UserID = "$user_id_value";
###set your database details
my @db_connect = ("DBI:mysql:database_name", "user_name", "password");
###connect to the DBMan SQL database
$DBH = DBI->connect (@db_connect) or die ("Content-type: text/html\n\n Could Not Connect");
###do your query
$query = qq!
SELECT session_id
FROM Sample_Users_Sessions
WHERE session_user_id = $UserID
!;
my $sth = $DBH->prepare ($query) or die ("Content-type: text/html\n\n Could Not Prepare");
$sth->execute or die ("Content-type: text/html\n\n Could Not Execute");
###do somthing with what you find
if ($sth->rows) {
#Do something here
$sth->finish;
# Disconnect
$DBH->disconnect();
exit;
}
else {
#do something else
$sth->finish;
# Disconnect
$DBH->disconnect();
}
You need to replace the red parts with your own values.
As I said before, this seems to be a Perl/MySQL question.
Simon.