http://qs321.pair.com?node_id=81306


in reply to multiple queries:

I'm not sure what the error from your query is... so, there are several assumptions that I will make..

Assuming there is a dependency between the first query and the second (ie: the second query uses part of the result from the first query), just perform your validation before calling the second query..

Some things that I see in your code, calling prepare repeatedly is not efficient, consider using placeholders in your query code, read this node if you're not sure about placeholders...also, it does not appear that you are using the -w switch and running your code under strict.. consider doing this, it can save you lots of debugging effort, and its not too hard to incorporate either...

So, your code can look like,

my $handle = $syb->prepare($query); while(my @row = $select->fetchrow_array()) { # assuming that $row[0] is what you want to use in the # next query if($row[0] == 'ok') # it passes validation, yay { $handle->execute($row[0]); # fetch all the rows here if you want } else { # this is how you trap errors, leave this blank if you wi +sh } }

HTH