Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-19-2005, 03:05 AM ODBC connection
Novice Talker

Posts: 8
Trades: 0
Hi,

I want to know how to make an odbc connection using php code.

Please send suggestions.

Thanks.

http://www.hytechpro.com
hytechpro is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-19-2005, 06:54 AM
Skilled Talker

Posts: 70
Trades: 0
What you need to do is make a connection string, which depends on the database type you are using. Then you need to use the odbc_connect() function, like this:
PHP Code:
$server ""// The name of the database server goes here
$database ""// The database name goes here
$user ""// The database username goes here
$pass ""// The database password goes here
$connection_string ""// This is where your connection string goes
$connection odbc_connect($strconnect$user$pass); // Connect to database 
To execute a database query, you need to use the odbc_exec() function:
PHP Code:
$query odbc_exec($strconnect// Query stuff goes here, store it in a variable); 
To close the connection, use this:
PHP Code:
odbc_close($connection); // For MS servers use the odbc_free_result() command 
You can view more info at:
http://www.php.net/manual/en/function.odbc-exec.php
and
http://www.php.net/manual/en/function.odbc-connect.php

I would also suggest downloading the PHP manual and you'll always have a functions list at your fingertips

Last edited by cerebro89; 12-19-2005 at 06:57 AM..
cerebro89 is offline
Reply With Quote
View Public Profile
 
Old 12-19-2005, 11:34 AM
Skilled Talker

Posts: 66
Trades: 0
nice answer
alternick is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to ODBC connection
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37350 seconds with 12 queries