Welcome Guest, Not a member yet? Register   Sign In
Database problem
#1

There is a problem with database driver. I get this message:
Call to undefined function mysqli_init() in /var/www/public_html/system/database/drivers/mysqli/mysqli_driver.php on line 126 
Thank's for some help with this?

Been using CI 2.X for years and is very satisfied. 

Quaymat
Reply
#2

if you create a php file containing the following code do you also get the same error?

Code:
<?php
$c = mysqli_init();
Reply
#3

You can use this to test to make sure that MySQLi is working correct.

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

$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
$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);

?>

// Code to create database tables

<?php
$serverName 
"localhost";
$userName   "username";
$password   "password";

// Attempt MySQL server connection. Assuming you are running MySQL server
$connId mysqli_connect($serverName$userName$password);
 
// Check connection
if ($connId === false)
{
 
   exit("ERROR: Could not connect. " mysqli_connect_error());
}
 
// Attempt create table query execution
$sql "CREATE TABLE persons(person_id INT(4) NOT NULL PRIMARY KEY AUTO_INCREMENT, first_name CHAR(30) NOT NULL, last_name CHAR(30) NOT NULL, email_address VARCHAR(50))";

if (
mysqli_query($connId$sql))
{
 
   echo "Table persons created successfully";
}
else
{
 
   echo "ERROR: Could not able to execute $sql. " mysqli_error($connId);
}
 
// Close connection
mysqli_close($connId);
?>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB