note 94257 added to function.odbc-connect

From: Date: Sun, 25 Oct 2009 23:43:16 +0000
Subject: note 94257 added to function.odbc-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-162089@lists.php.net to get a copy of this message
Here is my successful odbc_connect with mysql on Ubuntu. It took me a while to figure this out. Installed following packages using apt-get. apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libdbd-mysql-perl libmyodbc libmysqlclient15off mysql-client-5.0 mysql-common mysql-server-5.0 mysql-server-core-5.0 odbcinst1debian1 php5 php5-cli php5-common php5-odbc unixodbc /etc/odbc.ini ------------ myodbc3 = MySQL ODBC 3.51 Driver [myodbc3] Driver = /usr/lib/odbc/libmyodbc.so Description = MySQL ODBC 3.51 Driver Server = localhost Port = 3306 User = shyam Password = mypass Database = mysql Option = 3 Socket = /var/run/mysqld/mysqld.sock /etc/odbcinst.ini ---------------- [MySQL ODBC 3.51 Driver] Description = MySQL driver Driver = /usr/lib/odbc/libmyodbc.so Setup = /usr/lib/odbc/libodbcmyS.so CPTimeout = CPReuse = UsageCount = 1 my php script ------------ <html> <body> <? $conn = odbc_connect("DRIVER={MySQL ODBC 3.51 Driver};Server=localhost;Database=mysql", "shyam", "mypass"); $sql = "SELECT user from user"; $rs = odbc_exec($conn,$sql); echo "<table><tr>"; echo "<th>User Name</th></tr>"; while (odbc_fetch_row($rs)) { $user = odbc_result($rs,"user"); echo "<tr><td>$user</td></tr>"; } odbc_close($conn); echo "</table>"; ?> </body> </html> ---- Server IP: 69.147.83.197 Probable Submitter: 99.48.1.136 ---- Manual Page -- http://www.php.net/manual/en/function.odbc-connect.php Edit -- https://master.php.net/note/edit/94257 Del: integrated -- https://master.php.net/note/delete/94257/integrated Del: useless -- https://master.php.net/note/delete/94257/useless Del: bad code -- https://master.php.net/note/delete/94257/bad+code Del: spam -- https://master.php.net/note/delete/94257/spam Del: non-english -- https://master.php.net/note/delete/94257/non-english Del: in docs -- https://master.php.net/note/delete/94257/in+docs Del: other reasons-- https://master.php.net/note/delete/94257 Reject -- https://master.php.net/note/reject/94257 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#162089) next »