WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Connects to DSN `LocalServer`, selecting something, and outputing fields 1, 2.
Categories : ODBC, PHP Update Picture
Brian Wang
Date : Apr 13th 1998
Grade : 2 of 5 (graded 2 times)
Viewed : 4395
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Brian Wang
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

First, you have to configure a DSN for the Database you
want to connect via ODBC in Control Panel. If you want to name
your DSN `LocalServer`, then it will work just fine. The following
is a code snip that connects to DSN `LocalServer`, select something,
and output fields 1, 2.

<?
$mydb = odbc_pconnect("LocalServer","MyUsername","MyPassword");
$result = odbc_exec($mydb,"select * from MyTable");
while (odbc_fetch_row($result))
{
print odbc_result($result,1) . " " . odbc_result($result,2) .
"\n";
}
?>
Dave Walton <walton@nordicdms.com> ADDED :

When you set up the DSN to point to your database server, you can
also tell it which database on that server you want it to use. If
you do that, that DSN will always automatically use the database you
specified.

For example, say you have an SQL server named MyServer. On that
server you have a database named MyDB. In that database you have a
table named MyTable.

Now you set up a DSN called MyDSN (the exact steps to do this depend
on what version of ODBC you have).

Data Source Name: MyDSN
Server: MyServer
Database Name: MyDB

Once that`s done, you can send queries to MyDB without needing the
SQL "use" statement:

<?
$conn = odbc_connect("MyDSN", "MyUsername", "MyPassword");
$result = odbc_exec($conn, "select * from MyTable");
while (odbc_fetch_row($result)) {
print odbc_result($result,1) . "\n";
}
?>





A very simple database abstraction layer for the PHP 3.0 ODBC module.
Categories : ODBC, PHP
A set of functions sitting on top of the abstraction layer that makes it a little easier to do SQL stuff. Documentation is within
Categories : Databases, ODBC, Complete Programs, PHP
UDMSearch - a free search engine, indexing system.
Categories : Search Engines, Linux, PHP, MySQL, ODBC
odbc_autocommit -- Toggle autocommit behaviour
Categories : PHP, PHP Functions, ODBC
How to access MS Excel spread sheets from PHP
Categories : PHP, Excel, ODBC, Databases
How to connect to MS SQL 6.x+ database server via ODBC functions of PHP3 compiled with iODBC and Openlink drivers under Linux.
Categories : Databases, MS SQL Server, PHP, ODBC
This is a small Web Phone Database which is written in PHP3 and utilizes a ODBC Data Source.
Categories : PHP, ODBC
Dynamic WHERE CLAUSE depending on number of FORM FIELDS
Categories : ODBC, General SQL, PHP, Complete Programs, Databases
Voting Machine with Access 97
Categories : PHP, ODBC, WinNT, MS Access, Complete Programs
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Modification of Shane Caraveo's guestbook. Uses ODBC...some code modifications
Categories : ODBC, Databases, Complete Programs, PHP
Forum with Access 97
Categories : MS Access, Complete Programs, PHP, ODBC, WinNT
php for odbc /* connect to access from odbc */
Categories : PHP Classes, ODBC, MS Access, PHP
db2tab.php - Simple scripts to access IBM DB2 Universal DataBase tables through PHP ODBC funtions.
Categories : Databases, PHP, ODBC
ADODB Database Wrapper Abstraction Library for PHP: MySQL, MSSQL, Oracle, Interbase,ODBC, Microsoft Access and FoxPro.
Categories : PHP Classes, Databases, PHP, General SQL, ODBC