CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Can i call a subroutine in the while loop

 



datlaravi
Deleted

Jun 14, 2000, 6:51 AM

Post #1 of 3 (495 views)
Can i call a subroutine in the while loop Can't Post

hi,
I want to call a subroutine within a while loop and it is giving an error.
The code is
if ($oh) {
$select = "select location,conferenceRoomName, overHead from ConferenceRooms where conferenceRoomId =$loc";
$sybHandle = $syb->prepare($select);
$sybHandle->execute();
while (my($loc,$conf,$over)=$sybHandle->fetchrow ) {
if ($over == 0) {
print << "html";
<center><font size =5> There is no OverHead for </font><i><font size=6>$loc</font></i></center>
<center><font size =5><i>The following buildings has OverHead </i></font>
html
&getroom; #I am trying to call this subroutine.it is giving error at this point.
PLease help me
Thanks
}


mckhendry
Deleted

Jun 14, 2000, 7:15 AM

Post #2 of 3 (495 views)
Re: Can i call a subroutine in the while loop [In reply to] Can't Post

what is the error you are getting? what does it say?


datlaravi
Deleted

Jun 14, 2000, 7:21 AM

Post #3 of 3 (495 views)
Re: Can i call a subroutine in the while loop [In reply to] Can't Post

I am getting an error that "no statement executing"
in the subroutine getroom, i have select statement.
sub getroom {
$select ="select location, overHead from ConferenceRooms where overHead = 1";
$sybHandle = $syb->prepare($select);
$sybHandle->execute();
while (my ($loc,$over) = $sybHandle->fetchrow ) {
print <<"html";
<tr><td>$loc</td></tr><tr><td>$over</td></tr>
html
}
$sybHandle->finish();
}

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives