Home > Backend Development > PHP Tutorial > 求大神帮忙看看哪里错了

求大神帮忙看看哪里错了

WBOY
Release: 2016-06-23 13:58:56
Original
927 people have browsed it

if (!isset($_SESSION["sn"])){$_SESSION['sn']=0;setcookie('sn',$sn,time()+1);    if($_POST["submit"]){	if($sn=3)	{
Copy after login

alert("抱歉,您已经点击了3次");			location.href="zp.php";
Copy after login

exit();	}	elseif ($sn=="tull")	{
Copy after login

alert("123");			location.href="zp.php";
Copy after login

exit();	}	$newitem=$_POST["zp_user"];		$sql="insert into vote (awards,sn,pnone) values (1,'$sn',1)";	if(mysql_query($sql))	{    		$sn==$_SESSION['sn']+1;	}}	if($_POST["submit2"]){		if(empty($_POST['sn']))$_SESSION['zp_user']=$_POST['pnone'];$sql="insert into zp_user values('".($_POST['sn'])."')";	if(mysql_query($sql))	{		}}}
Copy after login


回复讨论(解决方案)

if(mysql_query($sql))
    {    
        $sn ==$_SESSION['sn']+1;
     
}
为何用==?

代码怎么都是分开的,这样很难看得到……

    if($_POST["submit"]){
    if($sn =3)
应为 ==

if($_POST["submit"]){
    if($sn=3)  // ==
    {

= 是赋值
== if条件判断才用到

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template