I have a problem with prepare function ==> Call to a member function prepare() on null i have tow pages classo.php and index.php
class
There are 2 big issues in your code:
In detail:
In oop you should forget about global variables. They are against the principle of encapsulation. Moreover, you do not even have any global variable in your code, so global $db;
line is meaningless. Declare a private $db variable on class level (property) initialise it in the connection() method and access it in the insert method.
You are calling the connection method as classo::connection();
. However, you would need to declare connection method as static. Either declare your connection method as static (but then change $db into static as well), or call it as a regular method using $this.