把數值發送php 讓php執行在資料庫保留

來源:互聯網
上載者:User
把數值發送php 讓php執行在資料庫儲存啊

第一個是未排序的 第二個是排序後擷取數值的 怎麼能把數值發送給資料庫儲存啊












































{foreach from=$shop item=i} {/foreach}

編號

名 稱

種 類

類 別

圖 片

簡 介

圖 示

介 紹

公 司

開 始

結 束

地 址

休 息

網 址

停 止

操 作

排 序

{$i["id"]} {$i["name"]} {$i["varietyid"]} {$i["classifyid"]} {$i["list_pic"]} {$i["introduction"]} {$i["show_pic"]} {$i["product_introduction"]} {$i["company"]} {$i["business_start"]} {$i["business_end"]} {$i["address"]} {$i["rest_flag"]} {$i["web"]} {$i["del_flag"]} 修改 刪除 上移 下移 置頂





------解決思路----------------------
你的 alert(r); 時已經得到了指定序列的數組 r
你只需將其傳給 php 程式即可,比如
$.post(location.href, {px:r}); //location.href 表示當前頁,其他目標你自己定

php 將收到
array(
'px' => array(1,3,5,2,4}
)
這樣的數組

再怎麼用就是你的事情了

------解決思路----------------------
$('#bn').click(function() {
var r = [];
$('.xh').each(function(i, t) {
r.push($(this).html());
});
alert(r);
});

改為
$('#bn').click(function() {
var r = [];
$('.xh').each(function(i, t) {
r.push($(this).html());
});
$.post(‘server.php', {px:r}); // server.php 表示接受資料的php
});


然後 server.php 中加入
$data = isset($_POST['px'])? $_POST['px'] : array();
print_r($data); // 列印擷取的資料

// 執行寫入資料庫的操作。
?>

這個需要你自己先搭建php + mysql 運行環境。以及需要瞭解php,mysql的文法。
搭建環境可以安裝wamp2來實現。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.