mysql_fetch_array()
得到 的结果是空!
$p_id 是不是字符啊!
$sql = "select * from product where p_id = $p_id "; 

解决方案 »

  1.   

    mysql_fetch_array的参数为空,lz的sql语句写错了,按楼上的写就好了
      

  2.   

    $p_id是等于字符。我把他用echo $sql 输出的都有值的
      

  3.   

    $total = 0;
    $array = explode("@",$_SESSION[producelist]);
    $arrayquantity= explode("@",$_SESSION[p_quantity]);
    $_SESSION[p_quantity] = implode("@",$arrayquantity);
    for($i=1;$i <count($array);$i++){
    $p_id = $array[$i];
    $num = $arrayquantity[$i];
    if($p_id!=""){
    $sql = "select * from product where p_id = '".$p_id."'";
    $result = mysql_query($sql);
    if( !$result )
    {
        exit( $sql );
    }
    $info = mysql_fetch_array($result);
    $total1 = $num * $info[p_price];
    $total+= $total1;
    $_SESSION["total"]=$total;
    print_r($i); 把sql在phpmyadmin里执行下,看能不能执行
      

  4.   

    不过我认为$p_id不应该是字符,貌似是个主键!应该是整型的楼主不知道有没有明白我的意思