專業廢棄物清運、大型廢棄家具,政府立案
正派經營,作業快速、合法可靠
壁癌處理專營社區消毒、害蟲防治,歡迎各大學校機關
環境消毒定期維護,免費現場勘查

首頁  •  j2h 論壇 • 新手討論     • 

[請教]test

房東:小強
發表時間:2011-05-09
[檢舉]


)



  1. <?php
  2. // make your db connection up here ...
  3. $link = mysql_connect(\'localhost\', \'user\', \'pass\');
  4. $db = mysql_select_db(\'dbname\', $link);
  5.  
  6. // handle POST
  7. if ($_POST) {
  8. // use $i to increment the weight
  9. $i=1;
  10. // loop through post array in the order it was submitted
  11. foreach ($_POST[\'fruit\'] as $fruit_id) {
  12. // update the row
  13. $result = mysql_query("UPDATE fruit SET weight=". $i . " WHERE id=". mysql_real_escape_string($fruit_id));
  14. // increment weight to make the next fruit heavier
  15. $i++;
  16. }
  17. }
  18. ?>
  19. <script type="text/javascript" src="jquery-1.2.6.js"></script>
  20. <script type="text/javascript" src="jquery-ui-1.5.1.min.js"></script>
  21. <script type="text/javascript">
  22. // when the entire document has loaded, run the code inside this function
  23. $(document).ready(function(){
  24. // Wow! .. One line of code to make the unordered list drag/sortable!
  25. $(\'#fruit_list\').sortable();
  26. });
  27. </script>
  28. <form method="POST" action="<?php echo $_SERVER[\'PHP_SELF\']?>">
  29.  
  30. <ul id="fruit_list">
  31. <?php // query fruit table and print out each item
  32. $result = mysql_query("SELECT id, name, weight FROM fruit ORDER BY weight");
  33.  
  34. // print the list items
  35. while ($row = mysql_fetch_assoc($result)) {
  36. echo \'<li>
  37. <input type="hidden" name="fruit[]" value="\'. $row[\'id\'] .\'" />
  38. \'. $row[\'name\'] .\'</li>\';
  39. }
  40. ?>
  41. </ul>
  42.  
  43. <input type="submit" name="reorder" value="Re-Order Fruit" />
  44.  
  45. </form>





  • 贊助網站       

    明日黃金屋
    買屋、賣屋、租屋、出租、房東租屋刊登、並提供租屋、最專業的服務、最安全親切的交易。
    搬家公司
    本公司為政府立案專業搬家公司,我們秉持客戶至上,正派經營理念,在大台北縣市一直有口碑
    租屋網
    提供租屋資訊、租屋廣告刊登、房屋託租、房客尋屋、租屋配對、電子地圖、房屋資料上傳



  •  共 0 人回應

    姓名:
    佈告內容: