看板 PHP 關於我們 聯絡資訊
我是個php的初學者~以下是我的程式碼~ <html> <head> <title>Collect training data</title> </head> <body> Input location: <form action="collect_training_data.php" method="post"> <input type="text" name="input" size="10"> <input type="submit" name="start" value="Start" size="5"> <input type="submit" name="stop" value="Stop" size="5"> </form> <br><a href='collect_training_data.php'>Redo</a><br> </body> </html> (以下是php的部份) <?php $sql_time="select now() as timestamp"; if($_POST['start'] && $input_location!=""){ echo "start to collect training data which location is : ".$input_location; $result=@mysql_query($sql_time); $time_begin= mysql_fetch_array($result); echo "<br>begin time : ".$time_begin['timestamp']; } if($_POST['stop']){ $result=@mysql_query($sql_time); $time_end= mysql_fetch_array($result); echo "<br>end time: ".$time_end['timestamp']; echo "<br> Time between {$time_begin['timestamp']} and {$time_end['timestamp']}; } ?> 我的疑問是 按下start按鈕再按下stop按鈕後只會顯示 $time_end['timestamp']的時間 究竟是哪邊的問題呢?? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.85.98.17
knives:這很正常阿,沒有顯示$time_end['timestamp']才不正常 08/21 23:13
ileadu:begin的時間 早就被洗掉了.. 08/22 02:16
beavis1103:那請問應該怎麼改才能兩個時間都顯示 08/22 13:47
knives:從一開始你的設計觀念就錯了,無關php阿 08/22 14:23
beavis1103:原來如此 我後來改用session就可以了 謝謝k大 08/22 17:14