duchaine1 Posted August 15, 2022 Share Posted August 15, 2022 Hi, I need to ask if there are any errors in this code? Also, where should this be uploaded to in file mgr.? (page name is connect.php) <?php $servername = "localhost"; $username = "itisok"; $password = "pwisok"; // Create connection $conn = mysqli_connect($servername, $username, $password;) // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?> <html> <head> </head> <body> <h1>PHP connect to MySQL</h1> </body> </html> Thanks, LD Quote Link to comment https://forums.phpfreaks.com/topic/315185-how-to-connect-php-to-mysql-any-errors-in-code/ Share on other sites More sharing options...
Barand Posted August 15, 2022 Share Posted August 15, 2022 7 minutes ago, duchaine1 said: I need to ask if there are any errors in this code? Yes - line 7. Plus it's normal to specify a default database. 7 minutes ago, duchaine1 said: where should this be uploaded to in file mgr.? Depends what you want to do with it and what operating system you are using. Quote Link to comment https://forums.phpfreaks.com/topic/315185-how-to-connect-php-to-mysql-any-errors-in-code/#findComment-1599389 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.