2012-08-28 171 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我只需要代碼顯示所有新購買從選擇日期? (對不起,我是新來的) –

相關問題