[英]what is the error in this PHP_MYSQL update commad?
what's the error in update command ?? 更新命令有什么错误? it doesn't update the database ? 它不会更新数据库吗?
if($action=="new")
{
$query1="insert into activity_basic_info(activity_id) values($activity_id)";
$result1=mysql_query($query1);
if($result1)
echo "01";
else
echo "00";
}
else
{
$query="update activity_basic_info set";
if(isset($name))
$query = $query." name='$name',";
if($describtion!="" && describtion!=NULL)
$query = $query." describtion='$describtion',";
if($city!=NULL&&$city!="")
$query = $query." city_id=$city,";
if($region!=NULL)
$query = $query." region_id=$region,";
if($street!=NULL)
$query = $query." street_id=$street,";
if($telephone!="")
$query = $query." telephone=$telephone,";
if($email!=NULL&&$email!="")
$query = $query." email='$email',";
if($url!=NULL&&$url!="")
$query = $query." url='$url'";
else
$query = $query."url=''";
$query = $query." where activity_id=$activity_id";
$result=mysql_query($query);
echo $query;
}
?>
You should check the success of $result = mysql_query($query); 您应该检查$ result = mysql_query($ query);是否成功。 then if false, check the value of mysql_error() http://php.net/manual/en/function.mysql-error.php 然后如果为false,请检查mysql_error()的值http://php.net/manual/zh/function.mysql-error.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.