https://www.microsoft.com/en-us/sql-server/developer-get-started/php/rhel/
https://zend18.zendesk.com/hc/en-us/articles/218197897-Configuring-a-Linux-Server-to-Connect-to-an-MSSQL-Database-Using-ODBC
http://asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/installing_configuring_odbc.html
http://www.stevepiercy.com/articles/how-to-install-and-configure-freetds-as-an-odbc-connector-to-microsoft-sql-server-on-centosrhel-for-lasso-9/
541 curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/mssql-tools.repo
542 sudo ACCEPT_EULA=Y yum install msodbcsql mssql-tools
543 sudo yum install unixODBC-devel
544 echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
545 echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
546 source ~/.bashrc
https://www.ibm.com/developerworks/library/os-php-odbc/index.html
isql -v asterisk-connector FreePBX mypasss DataElyonN_Test
echo "select GETDATE();" | isql -v asterisk-connector FreePBX mypass
echo " select * from tblAttendanceByPhone;" | isql -v asterisk-connector FreePBX mypass
select script
<?php
// Replace the value's of these variables with your own data:
$dsn = "asterisk-connector"; // Data Source Name (DSN) from the file /usr/local/zend/etc/odbc.ini
$user = "FreePBX"; // MSSQL database user
$password = "11222"; // MSSQL user password
$connect = odbc_connect($dsn, $user, $password);
//Verify connection
if ($connect) {
echo "Connection established.";
$sql = "SELECT * FROM tblAttendanceByPhone";
$rs = odbc_exec($connect,$sql);
echo "<table><tr>";
echo "<th>AttendanceByPhoneTeacherCID</th></tr>";
while (odbc_fetch_row($rs))
{
$result = odbc_result($rs,"AttendanceByPhoneTeacherCID");
echo "<tr><td>$result</td></tr>";
$result1 = odbc_result($rs,"AttendanceByPhoneID");
echo "<tr><td>$result1</td></tr>";
}
odbc_close($conn);
echo "</table>";
odbc_close($connect);
} else {
die("Connection could not be established.");
}
?>
Update
<?php
// Replace the value's of these variables with your own data:
$dsn = "asterisk-connector"; // Data Source Name (DSN) from the file /usr/local/zend/etc/odbc.ini
$user = "FreePBX"; // MSSQL database user
$password = "1222"; // MSSQL user password
$connect = odbc_connect($dsn, $user, $password);
//Verify connection
if ($connect) {
echo "Connection established.";
$sql = "update tblAttendanceByPhone set AttendanceByPhoneTeacherCID='$argv[1]' where AttendanceByPhoneID='$argv[2]'";
$rs = odbc_exec($connect,$sql);
odbc_close($connect);
} else {
die("Connection could not be established.");
}
if (odbc_error()) {
echo "I've found a problem: " . odbc_errormsg($conn);
}
?>
nano /etc/odbc.ini
[asterisk-connector]
Description = MS SQL connection to 'asterisk' database
Driver = FreeTDS
Database = DataElyonN_Test
Server = 192.168.1.97
UserName = FreePBX
Password = 1111
Trace = No
TDS_Version = 0.95
Port = 1433
------------------------------------------
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.2
UsageCount=1
[FreeTDS]
Description = Freetds v 0.95
Driver = /lib64/libtdsodbc.so.0