In the following code I see echo1
statement, after which I do not see anything printed on the UI.The username and password is correct. But PHP doesn't seem to connect to MySQL. Don't even see the die statement what am I doing wrong. After mysql_connect
is encountered the rest of the code doesn't work:
<?php
echo "echo1==========";
$con = mysql_connect("localhost","root", "xxxx123") or die("Error connecting to database");
echo "+++++++++ echo2";
echo $con;
mysql_close($con);
?>
You should be mising an error. Add :
ini_set('display_errors', 1);
error_reporting(E_ALL);
at the beggining of your script
No output means a fatal error. The only possible fatal error is "undefined function mysql_connect
(unless something's really messed up somewhere). This means the mysql
library is not installed, or it might just not be enabled in the php.ini
file.
Check said file, and while you're at it turn error_reporting
on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With