Catchable fatal error: Object of class mysqli could not be converted to string

前端 未结 2 405
囚心锁ツ
囚心锁ツ 2020-12-12 07:48

So I have a bit of a problem, I\'m EXTREMELY new to PHP and I\'m having a problem updating a string on my database, It\'s throwing out this error: Catchable fatal error: Obj

2条回答
  •  伪装坚强ぢ
    2020-12-12 08:17

    There are several problems with your code.

    • First of all, you are assigning the variable $query, but using $result when trying to fetch the result.
    • Secondly, you have included your connection ($conn), inside your query. It needs to be separated.
    • Finally, you probably need to put quotes around your value.

      $result = mysqli_query($conn, "UPDATE * wp_oxygenpurchaseusers
                         SET user_url =  '2'
                         WHERE display_name = '$name'");
      

    If user_url is always a number, you should really convert it to type INT instead of using a string.

提交回复
热议问题