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

求大神帮忙看看错哪了

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:55:01868browse

求大神帮忙看看哪里错了

<br /><br />if (!isset($_SESSION["sn"])){<br />$_SESSION['sn']=0;<br />setcookie('sn',$sn,time()+1);<br /><br />    if($_POST["submit"]){<br />	if($sn=3)<br />	{

alert("抱歉,您已经点击了3次");<br />			location.href="zp.php";

exit();<br />	}<br />	elseif ($sn=="tull")<br />	{

alert("123");<br />			location.href="zp.php";

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

------解决方案--------------------
if(mysql_query($sql))
    {    
        $sn==$_SESSION['sn']+1;
     
}
为何用==?
------解决方案--------------------
代码怎么都是分开的,这样很难看得到……
------解决方案--------------------
    if($_POST["submit"]){
    if($sn=3)
应为 ==

------解决方案--------------------
if($_POST["submit"]){
    if($sn=3)  // ==
    {

------解决方案--------------------
= 是赋值
== if条件判断才用到

Statement:
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