2014-03-28 23 views
-1

我在我的房地产网站上有投票选项。投票无法在xtemplate中工作

我发现民意调查选项不起作用。

这里是我的代码:

<?  
//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); 
    ?> 

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

+0

我已经更新我的职务。请检查一下 – user3472363

+0

你的更新代码在哪里? –

+0

我想这就是问题所在。我应该在哪里给更新代码。你能帮我 – user3472363

回答

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); 
?>