Voodoo Raja wrote:

Sorry for not posting it in the first place.

Will this sub.. chew memory if I run it a number of times.. or does it overwrite it.

sub read {
print "\nreading data";
$db = DBI->connect("DBI:mysql:$dbase:$hostname", $username, $password);
$query = $db->prepare("SELECT * FROM cash where f1 = '1002'");
$query->execute;
$numrows = $query->rows;
while (@array = $query->fetchrow_array ) {
($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10,
$field11, $field12, $field13, $field14, $field15, $field16, $field17, $field18) = @array;}
$query->finish;
$db->disconnect;
print "\nf1 is $field1";
$lasttrans = "$field1";
$newtrans = ($lasttrans+1);
}



this is the exact sub where I feel that I am doing something wrong.. Should this leave memory occupied if I run this loop a number of times What happans if I runn this a number of times...

I am sorry if I cant explain it anybetter.. I am trying my best to learn this. please take me as a very begginer..

Regards
Sam


From: Ramprasad A Padmanabhan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], Samuel Shankar <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: Display realtime data As it changes in the databse - TK
Date: Tue, 19 Aug 2003 11:32:33 +0530

Samuel Shankar wrote:

Hi List

I was wandering if someone can help me out in displaying database data in a
TK window.


please wander a little more, on google if you are looking for readymade script

I have tried a number of ways but I am loosing memory eventually.. I vet all
"my"'s are not really mine..


All I need to do is fetch from a database and display it In a GUI based
window.
Or some ones has got a a better ways to flush ..

Display real time database data without losing memory in perl TK

Best Regards
SAM



How can any one help if you dont post your code


Ram


What you seem to be doing is not very clear. Why are you running this loop
while (@array = $query->fetchrow_array ) {
($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10,
$field11, $field12, $field13, $field14, $field15, $field16, $field17, $field18) = @array;}


If you just want the last  transaction id  change the query
to "select max($field1) from cash where $x = $y ";

This will give you the last transaction id directly


BTW 1) Have you considered using an autoincrement field
2) Do not connect to the database in every function of yours .
Make one connection in the beginning and pass the handle to all functions.
3) And when you post a reply to a newsgroup post your reply *at the bottom* avoid top posting


Ram





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to