An Introduction to mSQL

1. From the manual

2. A sample lite library script
Download this script

    funct datePrompt( char $name, int $mon, int $mday, int $year )
    {
      $time = time();
      if( $mday == -1 ) { $mday = (int)strftime( "%d", $time ); }
      if( $mon == -1 ) { $mon = (int)strftime( "%m", $time ); $mon--; }
      if( $year == -1 ) { $year = (int)strftime( "%Y", $time ); }

      printf( "<select name=\"month_%s\">", $name );
      $count = 0;
      while( $count < 12 )
      {
        if( $mon == $count )
        {
          printf( "<option value=\"%d\" selected>%s\n", $count, monthtostr( $count ) );
        }
        else
        {
          printf( "<option value=\"%d\">%s\n", $count, monthtostr( $count ) );
        }
        $count++;
      }
    
      printf( "</select>" );
      printf( "" );
      printf( "<input type=\"text\" size=2 maxlength=2 name=\"day_%s\" ", $name );
      printf( "value=\"%d\">\n", $mday );
    
      $count = 0;
      printf( "<select name=\"year_%s\">\n", $name );
      printf( "<option value=\"%d\" selected>%d\n", $year, $year );
      while( $count < 3 )
      {
        $year++;
        printf( "<option value=\"%d\">%d\n", $year, $year );
        $count++;
      }
      printf( "</select>" );
    }
    
    
    funct monthtostr( int $month )
    {
      $Months[0] = "Jan";
      $Months[1] = "Feb";
      $Months[2] = "Mar";
      $Months[3] = "Apr";
      $Months[4] = "May";
      $Months[5] = "Jun";
      $Months[6] = "Jul";
      $Months[7] = "Aug";
      $Months[8] = "Sep";
      $Months[9] = "Oct";
      $Months[10] = "Nov";
      $Months[11] = "Dec";
    
      return( $Months[$month] );
    }

3. Compiling the script

    /usr/local/Hughes/bin/lite -lsample.lib sample.lite


Last Modified:   17 December 1997
St. Louis Unix Users Group - Linux SIG
Hughes Technologies