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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.