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

前端 未结 2 404
囚心锁ツ
囚心锁ツ 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.

    0 讨论(0)
  • $query = mysqli_query("$conn, UPDATE ");
    

    you are passing one solid string into function, instead of 2 separate parameters. * is superfluous too.

    I WISH there was a method to remove this kind of questions right after the OP read the answer.

    Instead of leaving it to hang around forever with 1 or 2 occasional votes.

    0 讨论(0)
提交回复
热议问题