-2

私のテーブルには、入力がNew PurchaseまたはExisting Product の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();

?>

編集が必要なのはこのページなのか、それとも私のインデックス ページ (カレンダーから日付を選択する場所) なのかわかりません。

4

1 に答える 1

0

最初var_dump($_POST)にnewpurchase_report.php内でnewpurchase_report.phpに投稿して、値がページに投稿されていることを確認する場合。$_POST['timestamp']次に、それらが存在する場合は、追加された日付が投稿された日付と等しい場所としてを使用して、データベースに対してクエリを実行できます。

これがあなたが探しているものであるかどうかはわかりませんが、私があなたがしていることを実際にあなたがしようとしていることであるならば、私は簡単な解決策を提供すると思いました。

于 2012-08-28T13:26:46.443 に答える