2014-03-12 74 views
-2

如果您在這裏訪問http://www.joomusic.info/joosilver.php您可以瞭解我的概念。我已經設置了所有的腳本和日曆,並且我在mysql數據庫中創建表名是Firstname,並且在這個表中有2列,Drawtime和2,winnernumbers。和我進行了connect.php文件連接DATABSE通過選擇日期顯示mysql數據庫值

這是成功的一半腳本,因爲我不我沒怎麼讓它充分

<script language="JavaScript" type="text/javascript" src="calendar/calendar.js"></script> 
<!--<strong><div align="right" id="timeval" style="color:#FF6600; font-family:Arial, Helvetica, sans-serif">--:--:--</div></strong>--> 
    <table width="420" border="1" > 
    <form name="showdraw" action="ooo.php" method="post"> 
    <tr bgcolor="#FF6600"> 
      <td><script> DateInput('cdate', true, 'YYYY-MM-DD'); </script></td> 
      <td> <input type="submit" value ="Show"> <input type="hidden" value="Show" name="action"> </td> 
    </tr> 
    <tr bgcolor="#FF6600"> 
     <td><h2>Draw Time</h2></td> 
     <td><h2>Wining Number</h2></td> 
     </tr> 
    </form> 
<?php 
include('connect.php'); 

現在這包括(「connect.php)之後;我在這個頁面中添加了哪些php腳本,然後我的腳本就像這樣工作http://joomusic.info/joosilver.php

+0

您的第二個鏈接不適用於我。 – Quixrick

+2

那麼你的問題是什麼? – Chitowns24

+0

好吧,我也設置第二個鏈接@Quixrick – user3412535

回答

0

好吧,實際上它需要很多工作來完成它,但我將專注於從數據庫中獲取結果。基本上,只需從帖子字符串中拉出日期值(我不知道你給它命名了什麼,所以我把它稱爲date)。然後,將其傳遞到數據庫並循環查看結果。最後格式化日期以顯示小時和分鐘,然後將其粘貼到表格中。

// GET THE DATE FROM THE FORM 
// I DON'T KNOW WHAT THE NAME OF YOUR DATE FIELD IS, BUT CHANGE IT IN $_POST['FIELD NAME'] 
$draw_date = date("Y-m-d", strtotime($_POST['date'])); 


// CONNECT TO THE DATABASE - THIS SHOULD BE SET ALREADY IN YOUR connect.php 
$link = mysqli_connect('DATABASE HOST', 'USERNAME', 'PASSWORD', 'DATABASE'); 


// BUILD OUT THE QUERY TO GET ALL RECORDS WITH THE SAME DRAW DATE AND ORDER THEM BY TIME 
$query = "SELECT Drawtime, winningnumbers FROM Firstname WHERE Drawtime = '".$draw_date."' ORDER BY Drawtime"; 


// EXECUTE THE QUERY 
$result = mysqli_query($link, $query) or die("Cannot Get Winning Numbers"); 


// START PRINTING OUT THE TABLE 
print " 
     <table>"; 


// LOOP THROUGH EACH OF THE RESULTS FROM THE DATABASE AND PRINT THEM OUT 
while ($row = mysqli_fetch_array($result)) { 

    // FORMAT THE DATE SO IT IS ONLY SHOWING THE TIME 
    print " 
     <tr> 
      <td>".date("H:i", strtotime($row['Drawtime']))."</td> 
      <td>".$row['winningnumbers']."</td> 
     </tr>"; 

} 

// CLOSE UP YOUR TABLE 
print " 
     </table>"; 
+0

你說,要讓它起作用還有很多事情要做,意思 ? – user3412535

+0

你能爲我做它,請它不能這樣工作http://joomusic.info/joosilver.php – user3412535

+0

你能給我你的電子郵件我會發送日曆腳本你會讓這個盒子...請.. .. !!! – user3412535

相關問題