PHP ODBC connection with Mysql

by Bhumi //Dec 31,2011 // No comment

PHP ODBC connection with Mysql
Share This:Share on Facebook2Share on LinkedIn2Tweet about this on Twitter1Share on Google+3Share on Reddit0Buffer this pageDigg thisEmail this to someoneFlattr the authorShare on StumbleUpon0Share on TumblrPin on Pinterest0

Today I am going to cover a topic say ODBC connection with PHP and MySQL and Since two three days I was working on it.

To make ODBC connection with MySQL tables, First of all you need to install MySQL ODBC drivers that is Connector-ODBC and you can get ODBC drivers from http://www.mysql.com/downloads/connector/odbc/. Once MySQL ODBC connection driver installed in your PC, you need to configure it.

To Configure MySQL ODBC connection follow the below steps:

  1. Go to Contral Panel >> Administrative Tools and then click Data Sources (ODBC)
  2. To open the ODBC Data Source Administrator
  3. Choose the System DSN tab
  4. Click on Add in the System DSN tab
  5. Select MySQL ODBC 5.1 Driver, then click Finish
  6. Now need to configure the specific fields Data source Name for the DSN.
  7. Click OK to save the DSN

Let’s have a look

Mysql ODBC DSN

In above box, enter the name of the data source(database) you want to access and in the Server field, enter the name of the MySQL host-name that you want to access(e.g localhost) then in user and password field enter database username and password.

Also Read:
Solution:Internet connection issue on AndroidEmulator
MySQL Connection: Let be Assured
Database BackUp Script

Now you are connected with ODBC and you can write php code for odbc connection with MySQL.

The odbc_connect() function is used to connect to an ODBC data source and The odbc_exec() function is used to execute an SQL statement.

After connecting with ODBC, The odbc_fetch_row() function is used to return records from the result-set. This function returns true if it is able to return rows, otherwise false

Then, To retrieve a fields The odbc_result() function is used to read fields from a record.

Let’s take one Example which show data after ODBC connection:

 

First Name

 

OUTPUT

 

RELATED POST

How to fetch and display feed in WordPress?

Share This:02113010Feeds are very useful features to read contents.So, Today i am going to explain about how to use feed in wordpress and which functions READ MORE

Method Chaining in PHP

Share This:2400000 Method Chaining is the new feature of object-oriented approach introduced in PHP5.Today I am going to explain how to use method chaining in READ MORE

To create zoho leads using PHP

Share This:0400000 Today i am going to explain about how to create zoho leads from php. Zoho provide online lead management system.Zoho leads take details READ MORE

Webservice in WordPress

Share This:2600000 Here i am going to explain new article about how to call webservice in wordpress. Webservices are useful to retrieve your contents ftom READ MORE

Clean HTML content in PHP

Share This:2400000 After a long long time i get time to write article and i am curious to write but didn’t get time. So, Today READ MORE

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">