Home > Backend Development > PHP Tutorial > 修改信息成功后内容未变

修改信息成功后内容未变

WBOY
Release: 2016-06-23 14:10:57
Original
987 people have browsed it

系统有4处错误提示,分别在第15、17、25、26行。Undefined variable number1(PS:我发现我一个月都在问这个问题……惭愧)

<?php   include "conn.php";   include "admin_header.php";   extract($_REQUEST);     $query="update $jiaoshi_table set     subject='$newsubject',teacher='$newteacher',zhicheng='$newzhicheng',specialized='$newspecialized',code='$newcode',intrduction='newintroduction' where id='$id'";   mysql_query("set names 'GB2312'");   $result=mysql_query($query);         $query="select number as sn,surplus as ssn from $jiaoshi_table where id='$id'";   mysql_query("set names 'GB2312'");   $result=mysql_query($query);   $row=mysql_fetch_array($result);		if($number1<$row['sn'])		{			if($number1<($row['sn']-$row['ssn']))			{				echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>人数不能少于现已选题人数,人数列修改失败!</big></b></font>";				echo"<meta http-equiv=\"refresh\" content=\"2;url=alter_keti.php\">";				exit;			}			else			{		    	$query2=mysql_query("update $jiaoshi_table set number='$number1' where id='$id'");				$query3=mysql_query("update $jiaoshi_table set surplus=surplus-($row[sn]-$number1) where id='$id'");				mysql_query("set names 'GB2312'");   				$result1=mysql_query($query3);			}		}		else		{			$query4=mysql_query("update $jiaoshi_table set number='$number1' where id='$id'");			$query5=mysql_query("update $jiaoshi_table set surplus=surplus+($number1-$row[sn]) where id='$id'");			mysql_query("set names 'gb2312'");   			$result2=mysql_query($query5);   		}		if($result==true)				{				   echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>修改课题成功!</big></b></font>";				   echo "<meta http-equiv=\"refresh\" content=\"1;url=alter_keti.php\">";				   exit;				 }				 else				 {				   echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>修改出错,请返回重新修改</big></b></font></p>";				   echo "<meta http-equiv=\"refresh\" content=\"1;url=alter_keti.php\">"; 				   exit;				 }		?><?php include "foot.php";?>
Copy after login


回复讨论(解决方案)

$number1 这个变量没值嘛,$number1是从哪取的值呀。

$number1 这个变量没值嘛,$number1是从哪取的值呀。 谢谢,我突然发现我把变量名改了……这下好了

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