致命错误:32中不支持的操作数类型

时间:2014-09-19 17:30:56

标签: php mysql

我一直收到以下错误,我想知道如何修复?

这是我第二次遇到这个错误,我第一次修复它但是由于某种原因我第二次无法修复它。

Fatal error: Unsupported operand types on line 32

这是第32行。

    $Views = $Views + 1; 

以下是完整的代码。

require_once' db.php';

if($_REQUEST && isset($_REQUEST['id'])){
    $sql = "SELECT * FROM user WHERE id='" . mysql_real_escape_string($_REQUEST['id']) . "'";
    $result = mysql_query($sql);
    $row = mysql_fetch_row($result);
    $TTVC = "SELECT views FROM user WHERE id='" . mysql_real_escape_string($_REQUEST['id']) . "'";
    $TTV = mysql_query($TTVC);
    $total = mysql_fetch_row($TTV);
    $Views = $total;
    $Views = $Views + 1;
    $sql1 = "UPDATE user SET views='$Views' WHERE id='" . mysql_real_escape_string($_REQUEST['id']) . "'";
    $result1 = mysql_query($sql1);

1 个答案:

答案 0 :(得分:1)

您将表示所选行的整个数组分配给$Views

$Views = $total;

据推测,您想要从中提取所选的views

$Views = $total[0];