I am trying to use ODBC with php and I seem to be having some problems. This is my code:
<?php
$connect = odbc_connect("digitallibrary", "root", "");
$sql = "SELECT name FROM books";
$result = odbc_exec($connect, $sql);
echo $result;
while (odbc_fetch_row($result)) {
$name = odbc_result($result, "name");
print("$name
");
}
odbc_close($connect);
?>
I have also installed mysql odbc connector and added this system DSN: Datasource Name : digitallibrary TCP/IP Server: localhost Port 80 user: root database:digitallibrary
When I run my code I get this warnings but nothing printed:
Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, SQL state IM014 in SQLConnect in E:\Program Files\xampp\htdocs\DigitalLibrary\index.php on line 9
Warning: odbc_exec() expects parameter 1 to be resource, boolean given in E:\Program Files\xampp\htdocs\DigitalLibrary\index.php on line 11
Warning: odbc_fetch_row() expects parameter 1 to be resource, null given in E:\Program Files\xampp\htdocs\DigitalLibrary\index.php on line 14
Warning: odbc_close() expects parameter 1 to be resource, boolean given in E:\Program Files\xampp\htdocs\DigitalLibrary\index.php on line 18
what am I doing wrong?