建议CSDN能编辑修改自己的帖子!下面我写的这个为什么一执行就网页无法显示!<?php 
include "config.ini.php"; 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>例子 </title> 
<style type="text/css"> 
<!-- 
.STYLE1 { font-size: 12px; 
color: #333333; 

--> 
</style> 
</head> <body> 
<?php 
if (!$_SESSION['user']) {      //这里是判断SESSION里有没有登陆过的名字 
?> 
<h3>对不起请登陆 </h3> 
<?php } 
else{  
?> 
<table width="385" height="249" border="0" cellpadding="0" cellspacing="0"> 
  <tr> 
    <td align="center" background="images/img.jpg"> 
<form id="form1" name="form1" method="post" action=""> 
      <table width="250" border="0" cellspacing="0" cellpadding="0"> 
        <tr> 
          <td height="50">&nbsp; </td> 
        </tr> 
        <tr> 
          <td height="30" align="center" class="STYLE1">用户名: 
            <select name="charguid" size="1"> 
          <?php } 
$query=mysql_query("select charname,charguid from t_char where accname='dianmo' group by charname"); 
$info_cx=mysql_fetch_array($query);    //执行查找 
      do{ 
          ?> 
            <option value=" <?php} echo $info_cx[charguid];{?>"> <?php} echo $info_cx[charname];{?> </option>                //将查找的内容加载到 菜单里 
<?php } while($info_cx=mysql_fetch_array($query)); {?> 
          </select> </td> 
        </tr> 
        <tr> 
          <td height="30" align="center" class="STYLE1">城&nbsp;&nbsp;市: 
            <select name="select2" size="1"> 
              <option value="1">安徽 </option> 
          </select> 
          </td> 
        </tr> 
        <tr> 
          <td height="30" align="center" class="STYLE1"> <p>地区: 
              <select name="select3" size="1"> 
              <option value="8D02">上海 </option>             </select> 
          </p> 
            <p> 
              <input type="submit" name="Submit" value="提交" /> 
</p> </td> 
        </tr> 
      </table> 
    </form> 
    </td> 
  </tr> 
</table> 
<?php }?> 
</body> 
</html>

解决方案 »

  1.   


    <?php
    include "config.ini.php";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>例子 </title>
    <style type="text/css">
    <!--
    .STYLE1 { font-size: 12px;
    color: #333333;
    }
    -->
    </style>
    </head><body>
    <?php
    if (!isset($_SESSION['user'])) {      //这里是判断SESSION里有没有登陆过的名字
    ?>
    <h3>对不起请登陆 </h3>
    <?php }
    else{ 
    ?>
    <table width="385" height="249" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" background="images/img.jpg">
    <form id="form1" name="form1" method="post" action="">
          <table width="250" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="50">&nbsp; </td>
            </tr>
            <tr>
              <td height="30" align="center" class="STYLE1">用户名:
                <select name="charguid" size="1">
              <?php }
    $query=mysql_query("select charname,charguid from t_char where accname='dianmo' group by charname");
    $info_cx=mysql_fetch_array($query);    //执行查找
          do{
              ?>
                <option value=" <?php echo $info_cx[charguid];?>"> 
                <?php echo $info_cx[charname];?> </option>         //将查找的内容加载到 菜单里
    <?php } while($info_cx=mysql_fetch_array($query)); ?>
              </select> </td>
            </tr>
            <tr>
              <td height="30" align="center" class="STYLE1">城&nbsp;&nbsp;市:
                <select name="select2" size="1">
                  <option value="1">安徽 </option>
              </select>
              </td>
            </tr>
            <tr>
              <td height="30" align="center" class="STYLE1"> <p>地区:
                  <select name="select3" size="1">
                  <option value="8D02">上海 </option>            </select>
              </p>
                <p>
                  <input type="submit" name="Submit" value="提交" />
    </p> </td>
            </tr>
          </table>
        </form>
        </td>
      </tr>
    </table>
    <?php }?>
    </body>
    </html>
      

  2.   

    要么是你引入的文件config.ini.php有错误,要么是你的写的程序有错误。
      

  3.   

    我引入文件肯定没错误的!,这个代码本来是正常的
    后来我在   里面加了个  else 就不对了主要是   {  } 嵌入好像某个部分错误了
    下面是我的引入代码  config.php
    <?php
     $hostnamemm="192.168.1.103";
     $dbusermm="root";
     $dbpasswordmm="5877777";
     $dbnamemm="us_pa";
     $dbmm=mysql_connect($hostnamemm,$dbusermm,$dbpasswordmm) or die('<script language="javascript"> alert("数据库连接失败!");javascript:history.go(-1);</script>');
     mysql_select_db($dbnamemm,$dbmm);
     mysql_query("SET NAMES 'latin1'",$dbmm);
    ?>