Copy link to clipboard
Copied
Normally I work with C# but now I'm playing around with PHP and it's fun. So I type code from books over and try to make some small things of my own.
I've got this piece of code:
$mysqli = new mysqli( 'localhost','root','wrongpassword','sportjegeestgezondblog');
if ($mysqli->errno) echo "unable to connect to database"; else echo "connected";
Where I deliberately give the wrong password but still mysqli->errno keeps returning 0 what am I doing wrong?
If you are using > PHP 5.2.9 or > PHP 5.3.0:
if ($mysqli->connect_error) {
echo "unable to connect to database";
} else {
echo "connected";
}
Copy link to clipboard
Copied
If you are using > PHP 5.2.9 or > PHP 5.3.0:
if ($mysqli->connect_error) {
echo "unable to connect to database";
} else {
echo "connected";
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more