我运行php代码

时间:2017-11-06 13:17:46

标签: php html

我写了一个PHP代码,我想使用easyphp和apache在本地服务器上运行它,但是当我运行它时,它是一个空白页面,没有错误出现,只是一个空白页面,你知道为什么吗?

这是我的代码:

 <?php

$myServer = "MyPc";
$myUser = "Agent";
$myPass = "123456";
$base = "BD";

$conn = mssql_connect($myServer,$myUser,$myPass);
  if (!$conn)
   {
     die('Not connected : ' . mssql_get_last_message());
   }


  $db_selected = mssql_select_db($base, $conn);
 if (!$db_selected)
      {
          die ('Can\'t use db : ' . mssql_get_last_message());

 mssql_select_db($base)or die ('accès impossible a la base de donnees');

   if(isset($_POST['test']))
       {
            if (!empty($_POST['Date_de_debut']) && 
                    (!empty($_POST['Date_de_fin'])))
            {

      /*echo $_POST['Date_de_debut'];
       echo $_POST['Date_de_fin'];*/

       $search = "SELECT TOP (200)DEP_Operation.operationDate, 

     FROM  DEP_Operation INNER JOIN
           DEP_Actions ON DEP_Operation.actionID = DEP_Actions.id INNER JOIN
           DEP_Devices ON DEP_Operation.deviceID = DEP_Devices.id INNER JOIN
           DEP_Errors ON DEP_Operation.errorID = DEP_Errors.id INNER JOIN
           DEP_Products ON DEP_Operation.productID = DEP_Products.id INNER 
      JOIN
           DEP_RootCause ON DEP_Operation.rootCauseID = DEP_RootCause.id 
       INNER JOIN
           DEP_Users ON DEP_Operation.personInCharge = DEP_Users.id
     where operationDate between  (CONVERT(Datetime, 
     '".$_POST['Date_de_debut']." 
    00:00:00.000',120)) and (CONVERT(Datetime, '".$_POST['Date_de_fin']." 
   00:00:00.000',120))";

      $stmt = mssql_query($search);
         ?>


  <html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <link rel ="stylesheet" href="style_wbr.css"/>
      <title>PORTAIL SUIVI</title>
   </head>
  <body>


 <form method = "post" >
   <div id="date">
   <input type="date" id="date_deb_filtre" name="Date_de_debut" />
    <input type="date" id="date_fin_filtre" name="Date_de_fin" />
   </div>

  <div class="test">
      <input type="submit" name="test" id="test" value="test"/>
   </div>
    </form>

   </br>
  <table id="tab" border="1">


                  <tr>
                      <th>Opération</th>
                      <th>Date</th>

                  </tr>
       <?php
          $ordre=1;
                  while ($data = mssql_fetch_assoc($stmt))
                  {

                      ?>
                      <tr>

                                <td><?php echo utf8_encode ($ordre); 
   $ordre++;?></td>
                                <td><?php echo utf8_encode 
   ($data['operationDate']);?></td>
                                <td><?php echo utf8_encode 
      (
                      </tr>


        <?php
         }

        $ordre = $ordre -1;
        ?>
        <h1><font-size="10"> <?php echo "Nombre de cartes dépannées : " , 
        $ordre; ?></font></h1>


        </table>
        <?php
   }

      }
    }
?>


  </body>
   </html>

我输入两个日期两个日期,当我按下utton时,会出现一个表格,这就是应该发生的事情。但是当我用导航器打开文件时,它只是一个空白页面,我不明白为什么

0 个答案:

没有答案