div刷新页面时会降低

时间:2011-06-16 14:19:19

标签: php html

我想为android制作一个每秒刷新的页面。所有的东西都运行良好,但是当我点击保留按钮时我在this页面面临的问题然后整个div下来并在上面留下一个小空间但是在下次刷新之后它变得可以。我试过没有div但它不起作用这是代码

<!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">
<?php
Header('Refresh:2;url=http://medical.gofreeserve.com/and/checkm.php');
?>
<head>

<style type="text/css">
<!--
.style2 {color: #FFFFFF}
-->
</style>
</head>

<body  bgcolor="#000000">

<?php 

include("../common/connection.php");

?>



<?php   


if(isset($_GET['reserve']))
{
 echo $sql = "UPDATE    newsevents SET booking ='1'  WHERE news_id='$_GET[val]'";
 $query = mysql_query($sql) or die(mysql_error());  
 }







$new_query=mysql_query("select * from newsevents where booking=0") or die(mysql_error());
while($row=mysql_fetch_array($new_query))
{
$id=$row['news_id'];
$date=$row['date'];
$news_text=$row['text'];



?> 



<div style="border-bottom:2px solid #FFFFFF" >
<form name="fm1" action="checkm.php"  method="get">
<table width="95%">



<tr>
<td width="60%" height="50" ><span class="style2"><?php echo $date ?></span></td>
<td width="40%"><span class="style2"><?php echo $news_text ?></span></td>
<td width="40%"><span class="style2"><input type="hidden" name="val" value="<?php echo $id?>" / ></span></td>
<td width="30%"><input type="submit"  name="reserve" id="reserve"  value="reserve"  /></td>

</tr>


</table>

</form>
</div>







<?php }?>



</body>
</html>

1 个答案:

答案 0 :(得分:2)

在运行SQL查询时,您正在回显SQL语句,这正在推动div。只需使用以下内容:

if(isset($_GET['reserve']))
{
  $sql = "UPDATE newsevents SET booking ='1'  WHERE news_id='".$_GET['val']."'";
  $query = mysql_query($sql) or die(mysql_error());  
}