Okay sorry for triple posting but I can't edit my posts...
I figured that this part was wrong after googling some troubleshooting, and it makes sense.
Instead of using something like this:
<?php$result = $this->db_query("SELECT * FROM users WHERE id={$id}"); ?>
I have to do this:
<?php$result = $this->[B]database[/B]->db_query("SELECT * FROM users WHERE id={$id}"); ?>
Anyway, now my error message is telling me my db_query is not correct:
<?php
public function db_query($sql) {
$result = mysqli_query($this->connection, $sql);
if (!$result) {
die("Database query failed: " . $this->errno);
}
return $result;
}
?>
Error message is:
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in ...\includes\class_database.php on line 28
I don't understand how mysqli_query makes my SQL commands = to null.
I'm calling a method in my user class, which then inserts a string "SELECT * FROM users" as an argument into my db_query method, which then passes the string into mysqli_query(), but it doesn't work.