你的sql语句好像有问题耶,可以这样写吗?

解决方案 »

  1.   

    $dbh= mysql_connect('localhost','zhaoren','zhaoren');
    mysql_select_db('love_me');
    $str_sql = "select * from record where id='$user_id'";
    $dangan_res = mysql_query($dangan_sql,$dbh);
    $dangan_data = mysql_fetch_array($dangan_res);
    //改if ($dangan_data)为
    if($dangan_res)//试试{
    $strUP = "update record set  ($email, $zip, $address, $birth , $sex, $tel, $province, $country, $degree, $true_name, $pseudonym, $constellation, $obj_kind, $marriage, $body, $belief, $blood_type, $smoking, $drinking, $height, $weight, $salary, $work_area, $bp, $house, $family, $hobby, $description, $occupation)  where id='$user_id'";
    }
    else
    {
    $strUP = "insert into record ($email, $zip, $address, $birth , $sex, $tel, $province, $country, $degree, $true_name, $pseudonym, $constellation, $obj_kind, $marriage, $body, $belief, $blood_type, $smoking, $drinking, $height, $weight, $salary, $work_area, $bp, $house, $family, $hobby, $description, $occupation) values('&user_id',)
    }";
      

  2.   

    SQL语句也有毛病。看看update和insert的用法吧。
      

  3.   

    UPDATE tbl_name SET col_name1=expr1,col_name2=expr2,...[WHERE where_definition] [LIMIT #]
    INSERT INTO tbl_name[(col_name,...)] VALUES (expression,...),(...),...