<?PHP
header("Content-Type:text/html;charset=UTF-8"); session_start();
include_once("function_db.php");
$link = connect_db(); $sql = "select * from message where isclearing = '已解决' order by M_time desc";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<TABLE cellSpacing=6 cellPadding=0 width=700>
<TBODY>
<TR>
<TH width=43> </TH>
<TD colspan="2" align="right"><input type="text" name="title1" />
<label>
<input type="submit" name="Submit" value="提交" />
</label></TD>
</TR>
<TR>
<TH style="VERTICAL-ALIGN: top"> </TH>
<TD width="531"><?=$row[M_title]?></TD>
<TD width="100"><?=$row[M_time]?></TD>
</TR>
<tr>
<td colspan="3"><?=$row[M_content]?></td>
</tr>
<tr>
<td colspan="3"><?=$row[ revert_message]?></td>
</tr>
</TBODY></TABLE>
<?
}
?>为什么我这样写了以后页面什么都没有啊
header("Content-Type:text/html;charset=UTF-8"); session_start();
include_once("function_db.php");
$link = connect_db(); $sql = "select * from message where isclearing = '已解决' order by M_time desc";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<TABLE cellSpacing=6 cellPadding=0 width=700>
<TBODY>
<TR>
<TH width=43> </TH>
<TD colspan="2" align="right"><input type="text" name="title1" />
<label>
<input type="submit" name="Submit" value="提交" />
</label></TD>
</TR>
<TR>
<TH style="VERTICAL-ALIGN: top"> </TH>
<TD width="531"><?=$row[M_title]?></TD>
<TD width="100"><?=$row[M_time]?></TD>
</TR>
<tr>
<td colspan="3"><?=$row[M_content]?></td>
</tr>
<tr>
<td colspan="3"><?=$row[ revert_message]?></td>
</tr>
</TBODY></TABLE>
<?
}
?>为什么我这样写了以后页面什么都没有啊
你这样写,当这边查询没值的时候 就一片空白了。
查詢數據庫沒有內容,所以進不了while循環
你直接在數據庫執行select * from message where isclearing = '已解决' order by M_time desc 看下有沒有記錄
<?
}
?> 最好改成<?php }?>
<?PHP
header("Content-Type:text/html;charset=UTF-8"); session_start();
include_once("function_db.php");
?>
<TABLE cellSpacing=6 cellPadding=0 width=700>
<TBODY>
<TR>
<TH width=43> </TH>
<TD colspan="2" align="right"> <input type="text" name="title1" />
<label>
<input type="submit" name="Submit" value="提交" />
</label> </TD>
</TR>
<?php
$link = connect_db(); $sql = "select * from message where isclearing = '已解决' order by M_time desc";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<TR>
<TH style="VERTICAL-ALIGN: top"> </TH>
<TD width="531"> <?=$row[M_title]?> </TD>
<TD width="100"> <?=$row[M_time]?> </TD>
</TR>
<tr>
<td colspan="3"> <?=$row[M_content]?> </td>
</tr>
<tr>
<td colspan="3"> <?=$row[ revert_message]?> </td>
</tr>
<?php
}
?>
</TBODY> </TABLE>
如果是的话:
$sql = "select * from message where isclearing = '已解决' order by M_time desc";
这个没值的情况下,
按照我在4楼写的代码,起码会显示
<input type="text" name="title1" />
<label>
<input type="submit" name="Submit" value="提交" />
</label>
一个 输入框和提交按钮的.
如果有值的话
下面还有你要显示的内容的.
<?PHP
header("Content-Type:text/html;charset=UTF-8"); session_start();
include_once("function_db.php");
?>
<TABLE cellSpacing=6 cellPadding=0 width=700>
<TBODY>
<TR>
<TH width=43> </TH>
<TD colspan="2" align="right"> <input type="text" name="title1" />
<label>
<input type="submit" name="Submit" value="提交" />
</label> </TD>
</TR>
<?php
$link = connect_db(); $sql = "select * from message where isclearing = '已解决' order by M_time desc";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<TR>
<TH style="VERTICAL-ALIGN: top"> </TH>
<TD width="531"> <?php echo $row['M_title']; ?> </TD>
<TD width="100"> <?php echo $row['M_time]'; ?> </TD>
</TR>
<tr>
<td colspan="3"> <?php echo $row['M_content']; ?> </td>
</tr>
<tr>
<td colspan="3"> <?php echo $row['revert_message']; ?> </td>
</tr>
<?php
}
?>
</TBODY> </TABLE>
<?php ?>用这种格式 要想输出字符,用 echo来输出.
好久没裸写了。.....有点别扭
header("Content-Type:text/html;charset=UTF-8");session_start();
include_once("function_db.php");
$link = connect_db();$sql = "select * from message where isclearing = '已解决' order by M_time desc";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<TABLE cellSpacing=6 cellPadding=0 width=700>
<TBODY>
<TR>
<TH width=43> </TH>
<TD colspan="2" align="right"> <input type="text" name="title1" />
<label>
<input type="submit" name="Submit" value="提交" />
</label> </TD>
</TR>
<TR>
<TH style="VERTICAL-ALIGN: top"> </TH>
<TD width="531"> <?php echo $row['M_title']?> </TD>
<TD width="100"> <?php echo $row['M_time']?> </TD>
</TR>
<tr>
<td colspan="3"> <?php echo $row['M_content']?> </td>
</tr>
<tr>
<td colspan="3"> <?php echo $row['revert_message']?> </td>
</tr>
</TBODY> </TABLE>
<?php
}
?>
echo mysql_num_rows($query);
echo mysql_num_rows($query);取出来的值是0啊
但是我在数据库里有匹配的数据啊。
可以猜到isclearing 字段是一判断标识,竟然存入中文,lz....
你大可以存入个数字,比如1,代表未解决,2就代表已解决.把1,2读到页面再做处理.为什么这样的字段也要在数据库里存中文呢?
try
====================
$sql = "select * from message where isclearing = binary '已解决' order by M_time desc";
<?PHP
include_once("function_db.php");
$link = connect_db();
$sql = "select * from message where isclearing = '已解决' order by M_time desc"; //要保证这条语句执行的时候有数据产生
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
print_r($row);
}
?>
如果有数据的话,就再把那个表格内容放进去就行了。