Here is my connection.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$dsn = 'DSN=demo;Server=demo;UID=demo;PWD=demo';
$conn = odbc_connect($dsn, '', '');
if ($conn) {
// Connection successful, proceed with query execution
echo "Connection successful.<br>";
// Define the SQL query
$sql = "SELECT * FROM employee"; // Ensure this is the correct table name
// Prepare and execute the SQL query
$stmt = odbc_prepare($conn, $sql);
if (odbc_execute($stmt)) {
// Get column names
$columns = [];
$num_fields = odbc_num_fields($stmt);
for ($i = 1; $i <= $num_fields; $i++) {
$columns[] = odbc_field_name($stmt, $i);
}
// Print the column names
print_r($columns);
echo "<br>";
// Fetch and display the results row by row
while ($row = odbc_fetch_array($stmt)) {
print_r($row);
echo "<br>";
}
} else {
echo "Query execution failed: " . odbc_errormsg($conn);
}
// Close the connection
odbc_close($conn);
} else {
echo "Connection failed: " . odbc_errormsg();
}
?>
from the localhost i cannot find the column name everytime it’s ouput like
Warning: odbc_prepare(): SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH: [S1C00] [TimesTen][TimesTen 18.1.4.42.0 CLIENT]Driver not capable in C:\xampp\htdocs\timesten\test_connection.php on line 20
Warning: odbc_prepare(): SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH: [S1C00] [TimesTen][TimesTen 18.1.4.42.0 CLIENT]Driver not capable in C:\xampp\htdocs\timesten\test_connection.php on line 20
Warning: odbc_prepare(): SQLColAttribute can't handle SQL_DESC_OCTET_LENGTH: [S1C00] [TimesTen][TimesTen 18.1.4.42.0 CLIENT]Driver not capable in C:\xampp\htdocs\timesten\test_connection.php on line 20
Array ( [0] => [1] => [2] => )
Array ( [John Doe] => John Doe [] => 30 [] => [email protected] )
Array ( [Jane Smith] => Jane Smith [] => 25 [] => [email protected] )
Array ( [Alice Johnson] => Alice Johnson [] => 28 [] => [email protected] )
Array ( [Bob Brown] => Bob Brown [] => 35 [] => [email protected] )
Array ( [Charlie Davis] => Charlie Davis [] => 40 [] => [email protected] )
i want to see the column name . it always showing me like this “Warning: odbc_prepare(): SQLColAttribute can’t handle SQL_DESC_OCTET_LENGTH: [S1C00] [TimesTen][TimesTen 18.1.4.42.0 CLIENT]Driver not capable in C:xampphtdocstimestenconnection.php on line 20”