2012-08-28 276 views
-2

在我的表显示main_stock从现场范围内的结果我有一个字段newown其中输入可以是新购现有产品从日历中选择日期,然后日期内选择

我想从已经选择每天创建的所有新购的领域newown报告 -

首先我有一个页面,他们可以从日历中选择curr_timestamp field的日期,然后点击提交。

当他们提交日期时,我需要将其带到php页面newpurchase_report.php并显示当天添加的所有新购买,任何帮助都会很棒吗?

谢谢

这是目前我newpurchases_report.php:

<?php 
    // connect to the database 

$host = '...'; 
$username = '...'; 
$pass = '....'; 

mysql_connect($host,$username,$pass); 
mysql_select_db("stock"); 
$curr_timestamp = $_GET['curr_timestamp']; 
$thenumber = 1; 
$data = mysql_query("SELECT * FROM main_stock WHERE curr_timestamp='$curr_timestamp' ORDER BY newown ASC ") 
or die(mysql_error()); 
print "<table border cellpadding=1 width=95%>"; 
print "<span style='font-size: 22px;background-color : #ffff00;'>New Purchases</span>"; 
print "<tr>"; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Number</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Data</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Master Category</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Category</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Product Description</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>New or Exsisting?/span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Barcode</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Serial No.</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Stockcode</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Status</span></td> "; 
print "<td><span style='font-size: 12px;background-color : #ffff00;'>Hiretrack</span></td> "; 
print "</tr> "; 

while($info = mysql_fetch_array($data)) 
{ 

print "<tr> "; 
print "<td><span style='font-size: 12px;'>". $thenumber++;"</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['curr_timestamp'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['mastercategory'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['category'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['product_desc'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['newown'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['barcode'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['serial'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['stockcode'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['status'] ."</span></td> "; 
print "<td><span style='font-size: 12px;'>".$info['hiretrack'] ."</span></td> "; 
print "</tr> "; 

} 

print "</table> "; 



// disconnect from the database 

mysql_close(); 

?> 

林不知道是否是这个页面需要编辑或我的索引页面(即从日历中选择日期) ?

+0

你的表单和表单处理程序是什么样的? –

+0

我们需要查看您的表单数据,以及日历输入字段的外观,特别是带有属性的

'元素 – mschr

回答

0

如果您在newpurchase_report.php中首先发布到newpurchase_report.php var_dump($_POST)以检查值是否发布到页面。那么如果他们是你可以使用$_POST['timestamp']作为添加的日期等于发布日期的情况下对数据库运行查询。

不知道这是你在找什么,但我认为我会提供简单的解决方案,如果我把它你做的事实际上是你正在做的。

+0

我确实希望您在使用数据库查询之前转义POST数据... –

+0

只是提供解决方案找到他们想要在数据库中使用的日期。意识到它是如何措辞听起来像我建议使用POST,我只是说,这是你需要的价值发现 – HarryWise

+0

时间戳确实带到newpurchase_report.php我只需要代码显示所有新购买从选择日期? (对不起,我是新来的) –

相关问题