Connecting to Database from PHP Class
Posted on 2011-03-25
I'm using a class to insert new data to database, but it's not working.
//This is the line that gives me an error
$this->db = new mysqli('localhost', 'root', '', 'abcd');
echo 'Error: Connection to database failed: '.mysqli_connect_error();
//Querying AllCustomer Table
$this->query = 'INSERT INTO AllCustomers (UserName, UserPass, EmailAddress)
$this->result = $db->query($this->query);
echo $this->db->affected_rows.' was updated.<br />';
echo 'An error has occurred. The update was not made.<br />';
Thank you in advance for your help!