Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Unable to connect to the database
#4

(This post was last modified: 05-16-2021, 03:34 PM by InsiteFX. Edit Reason: Spelliing error )

Did you try the config database settings alone to see if they work?
Also the base_url in your env.txt should have an ending backslash on it \

You can try this to see if you can connect stand alone.

PHP Code:
<?php
// Code to create the database

// Add your own username and password
$serverName "localhost";
$userName   "username";
$password   "password";

// Create the Database Connection
$connId mysqli_connect($serverName$userName$password);

// Check the Database Connection
if ($connId === false)
{
    exit("ERROR: Could not connect. " mysqli_connect_error());


// Create the Database
// Add your datya
$sql "CREATE DATABASE yourDatabaseName";

// Check that the Database was created
if (mysqli_query($connId$sql))
{
    echo "Database created successfully";
}
else
{
    echo "ERROR: Creating Database. " mysqli_error($connId);
}

// Close the Connection
mysqli_close($connId);

?>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Unable to connect to the database - by InsiteFX - 05-16-2021, 03:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB