民意调查不适用于xtemplate

时间:2014-03-28 11:27:35

标签: php

我的房地产网站上有投票选项。

我发现投票选项不起作用。

这是我的代码:

<?      
//Fetch Admin Header
$loc = "../includes/";
include($loc.'header.php');
//If POST, process form
if( isset($_POST['title']) && $_POST['title'] != ""){           
    $node = new sqlNode();
    $node->table = "`poll_question`";
    $node->push("text","title",$_POST['title']);
    $node->push("html","description",$_POST['description']);
    $node->push("text","date",$_POST['date']);
    $node->where = sprintf("where id = %s", $_POST['id']);
    $redirect = base64_decode($_POST['r']);
    die("<script>window.location='index.php?$redirect';</script>");
    }//End Process Post Form
    $sql = sprintf("select * from `poll_question` where id = %s", $_GET['id']);
    $result = $mysql->exSql($sql) or die($mysql->debugPrint());
    if(mysql_num_rows($result)<1){
    header("Location:index.php");
    die("<script>window.location='index.php'</script>");
    }
    $row = mysql_fetch_assoc($result);
    ?>

该值未在数据库中更新,我没有收到任何错误。 我不能一步一步地找出错误,因为这是一个大门户。

1 个答案:

答案 0 :(得分:0)

您错过了更新代码:

$result = $mysql->update($node) or die($mysql->debugPrint());

所以,这是你的代码

<?
$loc = "../includes/";
include($loc.'header.php');
//If POST, process form
    if( isset($_POST['title']) && $_POST['title'] != ""){           
        $node = new sqlNode();
        $node->table = "`poll_question`";
        $node->push("text","title",$_POST['title']);
        $node->push("html","description",$_POST['description']);
        $node->push("text","date",$_POST['date']);
        $node->where = sprintf("where id = %s", $_POST['id']);
        $result = $mysql->update($node) or die($mysql->debugPrint());
        $redirect = base64_decode($_POST['r']);
        die("<script>window.location='index.php?$redirect';</script>");

    }//End Process Post Form

    $sql = sprintf("select * from `poll_question` where id = %s", $_GET['id']);
    $result = $mysql->exSql($sql) or die($mysql->debugPrint());
    if(mysql_num_rows($result)<1){
        header("Location:index.php");
        die("<script>window.location='index.php'</script>");
    }
    $row = mysql_fetch_assoc($result);
?>