Jump to content

[SOLVED] ODBC


rabbitsfeat

Recommended Posts

Can anyone help?

 

I'm working through the MySQL tutorials at w3schools and the final one wants me to connect to something called ODBC. Take a look here: http://www.w3schools.com/php/php_db_odbc.asp

 

Later I have to select which driver to use... it just says to select the Microsoft Acess Driver... well there are 2 of these and I don't know which one to pick. Please can someone help?

 

I don't even know what this ODBC thing is for or if it's even worth me doing this part of the tutorial... perhaps someone can explain—maybe it's essential???

Link to comment
https://forums.phpfreaks.com/topic/89801-solved-odbc/
Share on other sites

Hey ther,

 

Actually using ODBC driver is very easy. First of all, you need to select odbc driver and create an odbc connection. You go to Control Panel, click on Administration tools, then click on Data Sources (ODBC). When the window opens up, click on a tab called System DSN. Click on ADD, select Driver to MS Access. When the second window opens up put a name in "Data source name" (this is the name which you will use for calling the connection for the ODBC driver), click on SELECT and choose where your Access database resides. After that click on OK and you are set to go.

 

Now, create a PHP script and put in a connection line like this:

 

$cx=odbc_pconnect("Data_source_name","","","");

 

And after this, you handle it like normal PHP + MySQL code. Of course the code is a little bit diferent, but there is a lot information about this on the web.

 

Here is a sample of query:

 

$cur=odbc_exec($cx,"select Oznaka,Naziv,JedinicaMjere,Pak,TarifnaSkupina,Dobavljac,Klasa,Vrsta,MinKol,MaxKol,OptKol,Cijena1,Cijena2, AVal,ACijena3,ACijena4,AVal2,ASkSmj,Altsifra,ARab,AdrPor,Barcode from TblArtikli");

 

I hope you got an idea. How to work with it. This is very basic.

Link to comment
https://forums.phpfreaks.com/topic/89801-solved-odbc/#findComment-460191
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.