Skip navigation links

MySQL Forums :: Perl :: MYSQL and Perl


Advanced Search

MYSQL and Perl
Posted by: Johannes Schuller ()
Date: June 05, 2012 05:21AM

Hello Community !

Fist of all, my congratulations for this outstanding forum here.

And here are my questions:

I have to do a MYSQL Server in our company for our customer tables. The Server is already working and I have installed a DB and tables in it for testing.
Now my problem is, that I have a list of data which is like this 11111(accountnr);name;street;..... etc.
In my perl script I have to search with the account number, and want to get back the row with the information to have them my perl script.
The Problem is I'm always only getting the account number instead the whole row back. Here is a part of my script:

if (/^customer\;/)
{
$kto = $line[1];

$connection1 = "DBI:mysql:testdb";
$user = "XXXXX";
$pass = "XXXXX";

$dbh = DBI->connect("$connection1","$user","$passwort") || die "DB connection not made: $DBI_errstr";

$sql = "SELECT $kto FROM mytable";
$sth = $dbh->prepare($sql);
$sth->execute();

while (@array =$sth->fetchrow_array())

{
print "*".$array[0]."*".$array[9]."*\n";
}


Thanks for your help.



Edited 1 time(s). Last edit at 06/05/2012 05:32AM by Johannes Schuller.

Options: ReplyQuote


Subject Written By Posted
MYSQL and Perl Johannes Schuller 06/05/2012 05:21AM
Re: MYSQL and Perl Randy Clamons 06/05/2012 11:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.