If I use odbc functions to connect to a database in PHP, How can I get or set the database character encoding? is there a function in PHP that I can use to do that?
An example of the odbc functions used in php script
<?php
//Connecting To The Database and getting $conn Variable
$conn = odbc_connect("database","username","password");
//Connection Check
if (!$conn)
{
echo "Database Connection Error: " . $conn;
}
$sqlResults = "SELECT EmpID AS EmployeeID, EmpName AS EmployeeName FROM Emp ORDER BY EmpName ASC";
$rsResults = odbc_exec($conn,$sqlResults);
if (!$rsResults)
{
echo "No Data Avialable";
}
else
{
while ( odbc_fetch_row($rsResults) )
{
$EmployeeID = odbc_result($rsResults,"EmployeeID");
$EmployeeName = odbc_result($rsResults,"EmployeeName");
//Printing the output
echo '<p>'. $EmpolyeeID . ' , ' . $EmployeeName . '</p>';
}
}
//Closing The Database
odbc_close($conn);
?>
You can find information on this here at Rob Allens dev notes page
rob allens dev notes