hi list,
im trying to write a perl srcipt that will connect to a mysql database
server, do some queries and print the output on the screen (or maybe append
the output to a file), that would look something like this.
+------+-------+----------+-------------+
| tnum | user | cust | area |
+------+-------+----------+-------------+
| 22 | nivra | testing | isdn |
| 23 | nivra | testing1 | ddu |
| 24 | nivra | testing1 | ddu |
+------+-------+----------+-------------+
below is my perl script.
#!/usr/bin/perl
use DBI;
$dbname= "dbname";
$dbuser = "dbuser";
$dbpass = "dbpass";
$dbhost = "localhost";
$dbport = "3306";
$dsn = "DBI:mysql:database=$dbname;host=$dbhost;port=$dbport";
$condition = " where date >= '2001/01/27' and petsa <= '2001/01/31' and
user = 'user'";
# Connect to the database
$dbh = DBI->connect($dsn, $dbuser, $dbpass);
# if needed and execute the SELECT
$sth = $dbh->prepare("SELECT tnum, user, type, area, stat FROM
tickets$where ");
$output = $sth->execute;
# clean up & disconnect from the DB
$sth->finish;
$dbh->disconnect;
print $output;
but it doesn't give me any output at all. i'd like to know if there is any
special parameter to use with sth->execute to do this. did i miss anything
here?
thanks for your time.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php