我需要從我的數據庫(時間間隔)中選擇下拉列表,並且我填寫了提交按鈕,你能幫助我嗎?從我的數據庫中選擇下拉間隔時間-php,sql,
的index.php
<?php
mysql_connect("localhost", "user", "pass") or die("Connection Failed");
mysql_select_db("db")or die("Connection Failed");
$query = "SELECT * FROM tbl";
$result = mysql_query($query);
$result1= mysql_query($query);
?>
<form action="" method="post">
<select>
<?php while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { ?>
<option value="<?php echo $line['register_date'];?>"><?php echo $line['register_date'];?></option>
<?php } ?>
</select>
<select>
<?php while ($line2 = mysql_fetch_array($result1, MYSQL_ASSOC)) { ?>
<option value="<?php echo $line2['register_date'];?>"><?php echo $line2['register_date'];?></option><?php } ?>
</select>
<input type="submit" value="get graph">
</form>
<?php
$sql_graph="select * from tbl where register_date>='$line' and register_date<='line2'";
$ress=mysql_query($sql_graph);
?>
我的表結構將是:
mysql> select * from table_name;
+-----+-------+-----------+---------+---------------+
| id | hours | item1 | item2 | register_date |
+-----+-------+-----------+---------+---------------+
| 44 | 23:55 | 511657 | 565553 | 2015-09-30 |
| 48 | 01:55 | 444657 | 144553 | 2015-10-01 |
| 49 | 02:55 | 2214657 | 144553 | 2015-10-01 |
| 50 | 03:55 | 1114657 | 224553 | 2015-10-01 |
| 51 | 04:55 | 414657 | 24553 | 2015-10-01 |
| 52 | 04:58 | 414655437 | 2453253 | 2015-10-01 |
| 53 | 04:59 | 55437 | 24553 | 2015-10-01 |
你能幫助我嗎?
如果我想從列'register_date'中選擇間隔。
2015-09-30 => 2015-10-01並輸出sql查詢中的所有列?
舉例下列link..my「項目」 http://54.187.150.122/php/index3.php
所有'mysql_'函數都被棄用,使用'mysqli'或'PDO :: MySQL'。你的問題到底是什麼? '堅持提交'不是很明確。 –