Я пытаюсь подключиться CodeIgniter 3 с Microsoft SQL Server 2008Connect Codeigniter 3 с MS SQL Server
Но я получаю сообщение об ошибке Ошибка сервера .
Я прилагаю код из database.php
$db['default'] = array(
'dsn' => 'Driver={SQL Server Native Client 10.0};Server=(local);Database=my_db;',
'hostname' => '(local)',
'port' => '',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'odbc', // or mssql or sqlsrv
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
//'autoinit' => TRUE,
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
Я попытался соединить простой файл ядра PHP с MS SQL, и это успешно подключиться.
Ниже приведен основной код файла PHP.
<?php
// Replace the value of these variables with your own data
$user = '';
$pass = '';
$server = "(local)";
$database = 'h2g2';
// No changes needed from now on
$connection_string = "DRIVER={SQL Server};SERVER=$server;DATABASE=$database";
$conn = odbc_connect($connection_string,$user,$pass);
if ($conn) {
echo "Connection established.";
$sql = "INSERT INTO hg_users (u_uuid,u_name, u_email,u_new_email,u_password,u_display_name,u_forgot_token,u_forgot_token_request_time,u_verify_token,u_verified,u_last_login_date,u_last_login_ip,u_created_date,u_modified_date,u_status)
VALUES ('1231233', '123123123 sdfsdfdsdf','ASsASas','asdasd','asd','ewrt','fgh','sdfgsasd','asdasd','2','zx','ZXcZX','aSzxCASD','ASDzxzx','1');";
$result = odbc_exec($conn,$sql);
echo "<pre>";print_r($result);
die;
} else{
die("Connection could not be established.");
}
?>
Я использую PHP 5.6 и Sql server 2008 с Xampp, Windows 7 32 бит.
"* .. Я пытаюсь подключить PHP скрипт с MS SQL Server 2008. *". Итак, где ваш код. Мы не можем принять ваш код. Мы не собираемся сидеть и смотреть это видео. И, «* .. Еще одна ошибка, которую я получаю. *». Какая ошибка? –
Да, возможно, поверьте мне! – rray
Вы считали, что сначала изучили php? – SnakeFoot