MySQL, PHP и… Microsoft Office

Листинг 5

<html> 
<head> 
<link rel="StyleSheet" href="common.css" type="text/css">  
<meta HTTP-EQUIV="Content-Type" content="Text/html; 
 charset=Windows-1251"> 
<title>MySQL Query</title> 
</head> 
<body> 
  
<?php 
  
  include('class.sql_batch.inc'); 
  
  $list_names = split_name_value($field_title); 
  
  /*************************************** 
  ** Create the object. 
  ***************************************/ 
  $batch = new sql_batch($sql_query, 
                            $sql_file, 
                            $list_names); 
  
  if($batch->do_connection()){ 
    $msg_count = 0; 
    // Execute each Query 
    $max_item = $batch->get_sql_count(); 
    for($i = 0; $i < $max_item; $i++){ 
      if($batch->do_sql_query($i)){ 
        if(!$batch->get_empty()){ 
          if($msg_count > 0){  
            echo "<hr    size=1 width=75%>"; 
          } 
          // Output result table  
          $numrows = $batch->get_max_rows();  
          $fields = $batch->get_field_arr();  
          $numtype = $batch->get_numeric_arr();  
          // Table header 
          echo "<center>\n";  
          echo "<table    border='0'>\n"; 
          echo "<tr>\n";  
          for($x = 0; $x <    count($fields); $x++){ 
            echo "<th>$fields[$x]</th>\n";  
          } 
          echo "</tr>\n";  
          // Table body 
          for($y = 0; $y <    $numrows; $y++){ 
            $row_class    = "odd"; 
            $y % 2 ?    0: $row_class = "even"; 
            echo "<tr    class='$row_class'>\n"; 
            $batch->set_row($y);  
            $values    = $batch->get_value_arr(); 
            for($x =    0; $x < count($values); $x++){ 
                 $align = ''; 
              if(isset($numtype[$x])){  
                   if($numtype[$x]){ 
                     $align = ' align=right'; 
                   } 
                 } 
                 echo "<td$align>$values[$x]</td>\n"; 
            } 
            echo "</tr>\n";  
          } 
          echo "</table>\n";  
          echo "</center>\n";  
          $msg_count++; 
        } 
      }else{ 
        echo '<b>Error: </b>'  
             .$batch->get_last_error()  
             ."<br>\r\n";  
      } 
    } 
    if($msg_count == 0){ 
      echo "<b>Done.</b> 
            <a HREF='javascript:history.go(-1)'>  
            Click Here</a>  
            to go back    to the page 
            you were    on.<br>\n"; 
    } 
  }else{ 
    echo '<b>Error message: </b>' 
         .$batch->get_last_error()  
         ."<br>\r\n";  
  } 
  
?> 
</body> 
</html> 

возврат

Наш канал на Youtube

1999 1 2 3 4 5 6 7 8 9 10 11 12
2000 1 2 3 4 5 6 7 8 9 10 11 12
2001 1 2 3 4 5 6 7 8 9 10 11 12
2002 1 2 3 4 5 6 7 8 9 10 11 12
2003 1 2 3 4 5 6 7 8 9 10 11 12
2004 1 2 3 4 5 6 7 8 9 10 11 12
2005 1 2 3 4 5 6 7 8 9 10 11 12
2006 1 2 3 4 5 6 7 8 9 10 11 12
2007 1 2 3 4 5 6 7 8 9 10 11 12
2008 1 2 3 4 5 6 7 8 9 10 11 12
2009 1 2 3 4 5 6 7 8 9 10 11 12
2010 1 2 3 4 5 6 7 8 9 10 11 12
2011 1 2 3 4 5 6 7 8 9 10 11 12
2012 1 2 3 4 5 6 7 8 9 10 11 12
2013 1 2 3 4 5 6 7 8 9 10 11 12
Популярные статьи
КомпьютерПресс использует