Jump to content

[SOLVED] cannot break/continue


justinh

Recommended Posts

 


   <?php
   
   
   
   if ( isset ( $_GET['clearbanker'] ) ){
   
   $objComport	= new COM ( "ActiveXperts.Comport" );
  
   $objComport->Logfile     = "C:\\PhpSerialLog.txt";
   $objComport->Device      = "COM5";
   $objComport->Baudrate    = 57600;
   $objComport->ComTimeout  = 1000;

   $objComport->Open ();

   if ( $objComport->LastError == 0 )
   {     
        Echo "Clearing Banker..<BR>";
        Echo "<BR>";
    

        $objComport->WriteString      ( "C" );
        
        while ( $objComport->LastError == 0 )
        {
            Echo "<b>".$objComport->ReadString  () . "</b>";
            Echo "<BR>";
        }


   }
   else
   {
       $ErrorNum = $objComport->LastError;
       $ErrorDes = $objComport->GetErrorDescription ( $ErrorNum );

       Echo "Error sending commands: #$ErrorNum ($ErrorDes).";
   }

   Echo "Ready.";

   $objComport->Close ();
   
   }
   
   
   if ( isset ( $_GET['mode'] ) ){
     
     switch($_GET['mode']){ 
       
       case "Dollars":
   
   $objComport	= new COM ( "ActiveXperts.Comport" );
  
   $objComport->Logfile     = "C:\\PhpSerialLog.txt";
   $objComport->Device      = "COM5";
   $objComport->Baudrate    = 57600;
   $objComport->ComTimeout  = 1000;

   $objComport->Open ();

   if ( $objComport->LastError == 0 )
   {     
        Echo "Scoop Mode..<BR>";
        Echo "<BR>";
    

        $objComport->WriteString      ( "S 1-" );
        
        while ( $objComport->LastError == 0 )
        {
            Echo "<b>".$objComport->ReadString  () . "</b>";
            Echo "<BR>";
        }


   }
   else
   {
       $ErrorNum = $objComport->LastError;
       $ErrorDes = $objComport->GetErrorDescription ( $ErrorNum );

       Echo "Error sending commands: #$ErrorNum ($ErrorDes).";
   }

   Echo "Ready.";

   $objComport->Close ();
   
   
   break;
   
   case "Pennies":
   
   $objComport	= new COM ( "ActiveXperts.Comport" );
  
   $objComport->Logfile     = "C:\\PhpSerialLog.txt";
   $objComport->Device      = "COM5";
   $objComport->Baudrate    = 57600;
   $objComport->ComTimeout  = 1000;

   $objComport->Open ();

   if ( $objComport->LastError == 0 )
   {     
        Echo "Scoop Mode..<BR>";
        Echo "<BR>";
    

        $objComport->WriteString      ( "S 1c" );
        
        while ( $objComport->LastError == 0 )
        {
            Echo "<b>".$objComport->ReadString  () . "</b>";
            Echo "<BR>";
        }


   }
   else
   {
       $ErrorNum = $objComport->LastError;
       $ErrorDes = $objComport->GetErrorDescription ( $ErrorNum );

       Echo "Error sending commands: #$ErrorNum ($ErrorDes).";
   }

   Echo "Ready.";

   $objComport->Close ();
   
   }
   break;
   }


?>


 

The code works fine, just giving an error of

Fatal error: Cannot break/continue 1 level in C:\xampp\htdocs\counting\clear.php on line 135.

 

It works, but was just wondering why this error is displaying.

Link to comment
https://forums.phpfreaks.com/topic/143482-solved-cannot-breakcontinue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.