我正在将timestamp=now()
从一个页面显示到另一个页面。我怎样才能通过这个功能?至于第二页,我想根据timestamp=now()
检索表格。我已经这样做了,但它不起作用。请帮助我。如何将Now()函数从一个页面传递到另一个页面php
编码
<script type="text/javascript" charset="utf-8">
function showCustomer(n)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("display").innerHTML=xmlhttp.responseText;
}
}
alert(n);
xmlhttp.open("POST","display.php?id="+ n,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form>
<?php $s= 'now()';
echo $s; ?>
<input type="button" value="h" name="s" onclick="showCustomer(<?php $s ?>)">
<div id='display' >
<?php
echo "111";
?>
</div>
我通过这个编码从数据库中检索数据:
<?php
include('config.php');
$sa="select * from table1 where timestamp=now()";
$result=mysql_query($sa) or die(mysql_error());
echo "<table border='1'>
<tr>
</tr>";?>
<?php
while($row = mysql_fetch_array($result))
{
$row['c1'];
$row['c2'];
$row['c3'];
$row['c4'];
}
我必须还要考虑Now()函数调用上翻页按钮点击此表。请帮助我。
请以与传递ID相同的方式将now()作为GET参数传递。 – RGV
字符串必须在js中引用 –
仅供参考:mysql_'查询已弃用并打开SQL注入。改为使用'mysqli'。 –