line 27是什么语句代码?

解决方案 »

  1.   

    <?
    session_start();
    include "../common.inc.php";
    $form_name=trim($form_name);
       $form_name=htmlspecialchars($form_name);
       if (empty ($form_name)) {
        $msg="您没有输入分类名称 ";
        $turn_page="addtype.php";
        error_0($msg,$turn_page);
        exit;
           }
       $typeResult=pg_exec($PG_CONN,"select typename from movietype where typename='$form_name';") or die ("不能查询!");
       $count=pg_numrows($typeResult);
    if ($count>0)
    {
    $echo="类别". $form_name ."已存在,请重新输入!";
    }
    else
    {
    $form_name=strval(trim("$form_name"));
    $tempSQL="INSERT INTO movietype VALUES ('$form_name');";
    $result=pg_exec($PG_CONN,$tempSQL);
    if ($result)
    {
    $echo="添加成功!";
    }
    else
    {
    $echo="添加失败!";
    }
    }
       
       
        
       
       ?>
    common.inc.php中:
    /*数据库的连接操作*/
      $PG_CONN=pg_connect("host=$PG_HOSTNAME dbname=$DATABASE user=$PG_USERNAME") or die("无法连接数据库,请重试");
      

  2.   

    $tempSQL="INSERT INTO movietype VALUES ('$form_name');";
    这条这么写不成吧.他对应的那个字段是什么呀.改成这样可以吗?
      

  3.   

    $form_name=strval(trim("$form_name"));
    应该是
    $form_name=strval(trim($form_name));$tempSQL="INSERT INTO movietype VALUES ('$form_name');";
    应该是
    $tempSQL="INSERT INTO movietype(typename) VALUES ('$form_name')";
    你的movietype表有几个字段,如果不是一个就要把字段名协商