<?php
/*
*此时设置两个参数 1 为满意 2 为不满意
*/
include_once("date/conn.php");
$user=$_POST[username1];
$sa=$_POST[satisfed];
$q_id=$_POST[q_id];
$result1=$pdo->query("select satisfed from tb_question where q_ID=$q_id");
foreach ($result1 as $row)
{
if($row[satisfed]!=null)
{
echo "<script>alert('该调查已经做过。');history.back();</script>";
exit;
}
}$result2=$pdo->query("select * from tb_question username='$user' and q_ID=$q_id");
if($result2->rowCount()==0)
{
echo "<script>alert('用户名不正确,谢谢你的参与');history.back();</script>";
exit;
}$result=$pdo->exec("insert into tb_question (satisfed)values('$sa')");
if($result)
{
echo "<script>alert('评论成功');location.href='index.php';</script>";
}
?>
/*
*此时设置两个参数 1 为满意 2 为不满意
*/
include_once("date/conn.php");
$user=$_POST[username1];
$sa=$_POST[satisfed];
$q_id=$_POST[q_id];
$result1=$pdo->query("select satisfed from tb_question where q_ID=$q_id");
foreach ($result1 as $row)
{
if($row[satisfed]!=null)
{
echo "<script>alert('该调查已经做过。');history.back();</script>";
exit;
}
}$result2=$pdo->query("select * from tb_question username='$user' and q_ID=$q_id");
if($result2->rowCount()==0)
{
echo "<script>alert('用户名不正确,谢谢你的参与');history.back();</script>";
exit;
}$result=$pdo->exec("insert into tb_question (satisfed)values('$sa')");
if($result)
{
echo "<script>alert('评论成功');location.href='index.php';</script>";
}
?>
解决方案 »
- 为什么PHP传递参数值为0时,empty()判断参数为真?
- 传值问题,很急,求各位帮忙
- 看不到图片,只显示小红叉
- js运行url的问题,在线等
- 跪求php动态下拉式菜单
- [求救]在PHP中如何取到flash send()過來的數據
- php+mysql优化搜索引擎的搜索结果【有酬】
- 几个比较简单的问题,多一些,但是不难。
- 再问几个问题
- Parse error: syntax error, unexpected '<' in ..\syclasstype.php on line 91,怎么解决
- 求助。关于中国移动讯通杯的自动投票问题
- DOMXPath evaluate之后,假设找到节点,如何获取这个节点的子节点的?值
修改为
$result=$pdo->query("insert into tb_question(satisfed) values('$sa')");试试~