When working with the database from the application, I get the following: Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/index.php:6 Stack trace: #0 {main} thrown in /var/www/html/index.php on line 6
Connection code: <?php $servername = "localhost:9906"; $username = "devuser"; $password = "devpass"; $dbname = "test_db"; $conn = mysqli_connect($servername, $username, $password, $dbname) or die("Fatal error: " . mysqli_connect_error()); if (mysqli_connect_errno()) { printf("Fatal error: %s\n", mysqli_connect_error()); exit(); } ?>
With the help of mysqlworkbench i can connect and work with the database! Tell me where I went wrong and why it doesn't work?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
When working with the database from the application, I get the following:
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /var/www/html/index.php:6 Stack trace: #0 {main} thrown in /var/www/html/index.php on line 6
Connection code:
<?php
$servername = "localhost:9906";
$username = "devuser";
$password = "devpass";
$dbname = "test_db";
$conn = mysqli_connect($servername, $username, $password, $dbname) or die("Fatal error: " . mysqli_connect_error());
if (mysqli_connect_errno()) {
printf("Fatal error: %s\n", mysqli_connect_error());
exit();
}
?>
With the help of mysqlworkbench i can connect and work with the database!
Tell me where I went wrong and why it doesn't work?