Py学习  »  Jquery

jquery ajax-参数号无效

user7461846 • 4 年前 • 88 次点击  

这里有什么问题:

function del_lc() {
    let la = $('#sela option:selected').text().toLowerCase();
    let lb = $('.lbact').text();
    let lc = $('.lcact').text();
    let lcid = $('.lcact').attr('data-id');
    let story = $('#storytxt').val();
    var fn = 'del_lc';
    $.post('index-pro.php', {la, lb, lc, lcid, story, fn}, function(data) {
        console.log(data);
    }); 
}

PHP

extract($_POST);
$sql = "insert into rec (what, la, lb, lc, story) values (:awhat, :ala, :alb, :alc, :astory)";
$st = $db->prepare($sql);
$st->execute(array(
    ":awhat" => 'lc',
    ":ala" => $_POST['la'],
    ":alb" => $_POST['lb'],
    ":alc" => $_POST['lc'],
    ":story" => $_POST['story']  // line 184
));
$sql = "delete from lc where id = :aid";
$st = $db->prepare($sql);
$st->execute(array(
    ":aid" => $_POST['lcid']
));

Fatal error - Invalid parameter number: parameter was not defined in D:\code\s00\index-pro.php:184 .

有什么帮助吗?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/37912
 
88 次点击  
文章 [ 1 ]  |  最新文章 4 年前
Elementary
Reply   •   1 楼
Elementary    5 年前

extract($_POST);
$sql = "insert into rec (what, la, lb, lc, story) values (:awhat, :ala, :alb, :alc, :astory)";
$st = $db->prepare($sql);
$st->execute(array(
    ":awhat" => 'lc',
    ":ala" => $_POST['la'],
    ":alb" => $_POST['lb'],
    ":alc" => $_POST['lc'],
    ":astory" => $_POST['story']  // line 184
));
$sql = "delete from lc where id = :aid";
$st = $db->prepare($sql);
$st->execute(array(
    ":aid" => $_POST['lcid']
));