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: Object of class mysqli could not be converted to string in C:\xampp\htdocs......\ban.php on line 11
Here is the source:
<?php
$servername = "localhost";
$username = "example";
$password = "example";
$name = "Brendan";
// Create connection
$conn = new mysqli($servername, $username, $password);
$query = mysqli_query("$conn, UPDATE * wp_oxygenpurchaseusers
SET user_url = '2'
WHERE display_name = $name");
while ($row = $result->fetch_assoc()) {
echo $row['classtype']."<br>";
}
?>
Thanks in advance for everyone's help :)
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.
There are several problems with your code.
$query
, but using$result
when trying to fetch the result.$conn
), inside your query. It needs to be separated.Finally, you probably need to put quotes around your value.
If
user_url
is always a number, you should really convert it to typeINT
instead of using a string.