<?xml version="1.0" encoding="windows-1252"?>
<node id="81306" title="Re: multiple queries:" created="2001-05-17 17:25:30" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="60407">
tinman</author>
<data>
<field name="doctext">
&lt;p&gt;I'm not sure what the error from your query is... so, there are several assumptions that I will make..
&lt;p&gt;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..
&lt;p&gt;Some things that I see in your code, calling prepare repeatedly is not efficient, consider using placeholders in your query code, read [id:\\7458|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...
&lt;p&gt;So, your code can look like,
&lt;code&gt;
my $handle = $syb-&gt;prepare($query);
while(my @row = $select-&gt;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-&gt;execute($row[0]);
             # fetch all the rows here if you want
      }
      else {
             # this is how you trap errors, leave this blank if you wish
      }
}
&lt;/code&gt;
&lt;br&gt;
HTH</field>
<field name="root_node">
81283</field>
<field name="parent_node">
81283</field>
</data>
</node>
