Lỗi fatal error call to undefined function odbc_connect năm 2024

Checking your browser before accessing xeisketypinen.gq.

This process is automatic. Your browser will redirect to your requested content shortly.

Please allow up to 3 seconds...

Bad Bot protection by AntiBot.Cloud

Your IP: 168.138.10.127

I am trying to connect to my local Database from the webserver but i get

Fatal error: Call to undefined function odbc_connect() 
             in -/-/-/7001238/web/s/sage2.php on line 15"

Any help on how to fix issue.

Here is the code i used to connect.

 $odbc['dsn'] = "Sage50";
 $odbc['user'] = "Peach";
 $odbc['pass'] = "XXXX";
 $mysql['host'] = "localhost";
 $mysql['user'] = "root";
 $mysql['pass'] = "";
 $mysql['dbname'] = "sagetest";
 $mysql['idfield'] = "id";
 $debug=true;
 // Step 1: Connect to the source ODBC and target mysql database
 if ($debug) echo "Connect to " . $odbc['dsn'] . ' as ' . $odbc['user'] . "\n";
 $conn = odbc_connect($odbc['dsn'], $odbc['user'], $odbc['pass']);
 if (!$conn) {
    die("Error connecting to the ODBC database: " . odbc_errormsg());
 }
 $myconn = mysql_connect($mysql['host'], $mysql['user'], $mysql['pass']);
 if (!$myconn)
    die("Error connecting to the MySQL database: " . $mysql_error());
 if (!mysql_select_db($mysql['dbname'], $pupilpath))  die("Error selecting the database: " . mysql_error());
// Step 1.5: loop through each table with steps 2-7
$allTables = odbc_tables($conn);
$tablesArray = array();
while (odbc_fetch_row($allTables)) {
   if (odbc_result($allTables, "TABLE_TYPE") == "TABLE") {
      $tablesArray[] = odbc_result($allTables, "TABLE_NAME");
   }
}

Thank you for your time!

Chán thế, thế nếu muốn kết nối với Access khi kô cài PHP với IIS thì làm thía nào hả các pác! Mà quái nhỉ, localhost nhà em xài Apteche2Triad mà!


netstavi

15-01-2006, 20:49

Nhà cu dùng cái đó, nhưng cái host cu dùng đâu phải là cái đó, xem nó support cái gì,


nguyencaophuong

15-01-2006, 21:12

Thế host cần support gì để làm việc được với Access và chạy được hàm về odbc hả bác?


netstavi

15-01-2006, 21:19

nguyencaophuong = F_Cornor ?


nguyencaophuong

15-01-2006, 22:58

F_Cornor là gì vậy bác, không bít thì hỏi, sao bác lại nói gì thế! Hix hix


netstavi

15-01-2006, 23:04

Muốn chạy access thì host phải support access chứ, nó support mysql mình dùng access thì nó hiểu sao được :)

I am trying to connect to Microsoft SQL Server but I get Fatal error: Call to undefined function odbc_connect() in:

connect =odbc_connect("kfm1","sa","removed"); if(!$connect) { exit("Connection Failed: " . $connect); }

I can connect with tsql -S sqlserver -U xxxxxxxxx -P xxxxxxxxx and with osql -S kfm1 -U xxxxxxxxx -P xxxxxxxxx using the odbc.ini

Below is the setup.

Centos 6.8

Cpanel::Easy::Apache v3.32.13 rev9999

PHP 5.5.35

freetds v1.00.13

Freetds.conf looks like this

[sqlserver]

host = IP address removed

port = 1433

tds version = 8.0

/*******************/

odbc.ini

[kfm1]

Driver=FreeTDS

Servername=sqlserver

Database =M1_KF

TDS_Version = 8.0

/********************/

odbcinst.ini

[FreeTDS]

Description = FreeTDS unixODBC Driver

Driver = /usr/lib64/libtdsodbc.so

Setup = /usr/lib64/libtdsS.so

CPTImeout=

COReuse=

FileUsag=1

Trace = Yes

TraceFile = /tmp/sql.log

ForceTrace = Yes

/****************************************/