Proper usage of MySQLi

M.S.R

New Member
Can anyone instruct me on the proper way to use the MySQLi extension in PHP? I have always used procedural MySQL functions before and want to make the change but am finding the examples on PHP.net and other sites way too complicated. There seems to be multiple methods to do the same thing. I want to use it in the following method:\[code\]function checkCredentials($username, $password){ $q = $db->prepare("SELECT id FROM `users` WHERE username=? AND password=? LIMIT 1"); $q->bind_param('ss', $username, $password); $q->execute();}\[/code\]That's as far as I've got going by the PHP.net examples but I get this error:\[quote\] Fatal error: Call to a member function prepare() on a non-object in C:\xampp\htdocs\classes\user.class.php on line 14\[/quote\](the \[code\]$db\[/code\] variable is a handle in my user class and that works fine)It just seems the documentation is far too complicated for someone who's never used the entention before and for someone who's moderately new to classes and OOP.Does anyone have links to pages explaining how to connect/prepare statements/execute queries and everything or can put it down in an answer?Thank you.
 
Back
Top