Though it may be a preference to use either
mysqli_*, the real problem is understanding the database API you are using. People can still write incorrect code using
PDO. What I strongly suggest is to stop mix matching procedural with
OOP instead procedural and use prepared statements instead of regular queries. Also, I strongly suggest learning what each single letter data type means before you start using them. It’ll make your life a lot easier if you understand what you are doing and not just doing random guess work.
PHP is not some kind of “black magic” programming language like everyone thinks it is. Programming in general is based on one’s thinking logic.
EDIT: To solve your problem, you haven’t created the
mysqli variable. What I love about
PHP's error messages is that it’s written in plain simple English.
It even gives you the line where it’s complaining about.