1

I have a simple code for selecting data using MySQl and PHP. Here it is:

<?php
require_once 'login.php' ;

$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die ("Unable to connect to MySQL: " . mysql_error());

mysql_select_db($db_database)
or die("Unable to choose DB: " . mysql_error());

$query = "SELECT * FROM bank";
$result = mysql_query($query);
if (!$result) die ("Failed with connection to DB: " . mysql_error());
$rows = mysql_num_rows($result);
for ($j=0; $j < $rows; ++$j) { 
$row = mysql_fetch_row($result);
echo 'MFO: '   . $row[0] . '<br/>';
echo 'NAME: '  . $row[1] . '<br/>';
echo 'STATE: ' . $row[2] . '<br/><br/>';
}   
?>

But i have to use ODBC driver instead of standard integrated driver. I've read a lot of information but haven't find anything , so maybe someone help what should i add or rewrite in this code for using ODBC ?

1 Answer 1

1

There are a lot of odbc functions in PHP.

http://php.net/manual/en/function.odbc-connect.php

You can connect with this functions to mysql and other databases. In the commments on php.net you can find some examples how to connect to MySQL.

http://www.mysql.de/products/connector/

Here you can find an ODBC driver for MySQL.

Sign up to request clarification or add additional context in comments.

1 Comment

I've downloaded it actually. I guess i have to do something with DSN.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.