Hello All,

I'm trying to do a SELECT, process some data from the SELECT and then a little later, an INSERT OR SELECT in the same
application. This is how I'm trying to do it but I'm not getting any output for the 2nd SELECT statement



TIA,


Tom Castonzo

#<snippet>
$dbh = webConnectDB::connect();

#The SQL query
$sth = $dbh->prepare(" SELECT house_number,low_rate,mid_rate,high_rate
                       FROM weekly_rental_rates
                       WHERE house_number = ?
                    ");

#Convert the param into an SQL-friendly format
$sth->bind_param(1,$rental); #coming in from a form

$sth->execute();

############################################################
#Associate perl variables with each output column
# These variables come from the SELECT statement in this case
$sth->bind_columns(\$c1, \$c2, \$c3,\$c4);
############################################################


print"<table align=\"center\" width=\"600\" border=\"1\" bordercolor=\"black\"><tr bgcolor=\"#3399cc\"><th>House Id</th><th>Low</th><th>Mid</th><th>High</th></tr>\n";
while( $sth->fetch)
{
print"<tr align=\"center\" bgcolor=\"#ffffff\"><td>$c1</td><td>$c2</td><td>$c3</td><td>$c4</td></tr>\n"
;
}


print"</table>\n";


#Try to reuse our statement handle $sth my ($c5); $sth = $dbh->prepare("SELECT house_name FROM rental_units WHERE house_num = ?

                      ");
$sth->bind_param(1,$rental);
 $sth->execute();
 $sth->bind_columns(\$c5);

  # Nothing is outputting here
  while($sth->fetch) {
   print"Rental Unit Data: $c5<br>\n";
   }

#</snippet>



Reply via email to