<?php
session_start();
//include("indexbase.php");
include("conn.php");
//$email=$_SESSION[email];
if(isset($_POST['mot_de_pass']) || isset($_POST['remot_de_pass']) || isset($_POST['cilivite']) || isset($_POST['telephone'])
     || isset($_POST['portable']) || isset($_POST['adress']) || isset($_POST['post']) || isset($_POST['ville'])
  || isset($_POST['pays']))
{
 
$sql="update clientcompte (mot_de_pass,remot_de_pass, cilivite,telephone, portable,adress, post, ville, pays) " 
."values ('','','','','$_POST[mot_de_pass]','$_POST[remot_de_pass]','$_POST[cilivite]','$_POST[telephone]',
'$_POST[portable]','$_POST[adress]','$_POST[post]','$_POST[ville]','$_POST[pays]')";//$sql="update clientcompte set mot_de_pass='$_POST[mot_de_pass]' where email='$email' "; 
$result=mysql_query($sql); if ($row=mysql_fetch_array($result)){

echo "<script language='javascript'>alert('modifer votre infos success!');history.back();</script>";
 }
mysql_close($conn);
}
?>提示的错误信息是:Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in先谢谢大家了!

解决方案 »

  1.   

    $result=mysql_query($sql);if ($result){echo "<script language='javascript'>alert('modifer votre infos success!');history.back();</script>";
     }
    mysql_close($conn);
    }
    直接判断试试
    mysql_fetch_array好像不能获取update的返回值,update也没什么返回值
      

  2.   


    $result=mysql_query($sql) or die(mysql_error());
      

  3.   


    $result=mysql_query($sql);//这个SQL语句是update,他返回的不是资源类型的变量,而是true或false
    if ($row=mysql_fetch_array($result)){//mysql_fetch_array()中的参数需要是资源类型的变量,如用select语句执行后返回的就是资源变量
    echo "<script language='javascript'>alert('modifer votre infos success!');history.back();</script>";
    }
      

  4.   

    你是不是想把得到的数据,插入表中呀?用的sql语句应该是 insert into 而不是update$sql="insert into clientcompte (mot_de_pass,remot_de_pass, cilivite,telephone, portable,adress, post, ville, pays) "  
    ."values ('','','','','$_POST[mot_de_pass]','$_POST[remot_de_pass]','$_POST[cilivite]','$_POST[telephone]',
    '$_POST[portable]','$_POST[adress]','$_POST[post]','$_POST[ville]','$_POST[pays]')";
      

  5.   

    <?php
    session_start();
    //include("indexbase.php");
    include("conn.php");
    $email=$_SESSION[email];if(isset($_POST['mot_de_pass']) || isset($_POST['remot_de_pass']) || isset($_POST['cilivite']) || isset($_POST['telephone'])
         || isset($_POST['portable']) || isset($_POST['adress']) || isset($_POST['post']) || isset($_POST['ville'])
      || isset($_POST['pays']))
    {
     $sql="update clientcompte set mot_de_pass='$_POST[mot_de_pass]' where email='$email' "; 
    $result=mysql_query($sql)or die(mysql_error());
    if ($result){

    echo "<script language='javascript'>alert('modifer votre infos success!');history.back();</script>";
     }
    mysql_close($conn);
    }
    ?>数据我之前已经插入过数据库了,现在想更新数据,刚改了一下,javascript提示成功了,但我在表格里填的信息没有读进数据库,只是删除了数据库里的mot_de_pass, 为什么啊?
      

  6.   

    var_dump($_POST['mot_de_pass']); // 这里看看到底是什么内容$sql="update clientcompte set mot_de_pass='$_POST[mot_de_pass]' where email='$email' ";