mysqli_query() expects parameter 1 to be mysqli, object given
In database connection class you return connection. In PHP class you have to catch that connection variable
$connection = new createCon();
$conn = $connection->connect();
Then you can use that $conn
variable as a mysqli_query()
parameter like
$result = mysqli_query($conn, $query);
You want to pass in $connection->myconn
instead of $connection
. As in:
$result = mysqli_query($connection->myconn, $query);
As it stands, you're passing in an instance of your class, rather than a mysqli, which is what the error messages are complaining about.