I have this code:
$mysqli = new mysqli('localhost','username','password','database');
$insert = "INSERT INTO submissions ( client_name, client_company ) VALUES ('$client_name', '$client_company' )";
if ( $mysqli->query($insert) === TRUE ) {
echo "success";
} else {
echo "Error: " . $mysqli . "<br>" . $mysqli->error;
}
In my development environment it runs perfectly, inserting the variables into the correct table columns.
However in production I get this error:
Catchable fatal error: Object of class mysqli could not be converted to string in 'path' on line x
I know that:
- There is no error with my mysqli connection as the rest of my application uses the credentials etc. fine to retrieve data from my db in both dev/live
- That this code runs fine, inserts correctly, doesn't error in my dev environment.
I've looked for solutions to the Error message- and have tried a few, but I remain unconvinced that this is the actual cause for the issue.