Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Supporting Technologies > Server-Side Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-29-2003, 01:27 PM   #1
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,014
Default [Q] Setting up connection between MS Access and PHP...

Howdy guys...

I have a question... I have searched forum and google, but I couldn't find good answer on this question...

This is what I want to do... I have to create a connection to the MS Access database from Flash MX via PHP... To test this locally, I am on W2K and IIS 5.0... and eventually progarm will be running on WXP server with DSN... (This part, I will be needing some more searching...) According to the articles that I have read, I will be needing ODBC driver installed on the machine for PHP to have an access to the MS Access database... So, I have been to the Microsoft's Universal Data Access Web Site to find the ODBC driver, http://www.microsoft.com/data, where I have been more confused...

I was able to find some information on Microsoft Data Access Components (MDAC), OLE DB, ADO, and ODBC... Basicaly what it said on the page is that MDAC, OLE DB, ADO all works on top of ODBC which makes sense so far... Well... The confusing part is that I cannot find any link where I can download ODBC driver for Windows... According to the search from this forum, somebody suggested that I can basically install ODBC driver with MS Office, but I don't see that option on my machine...(I don't have ODBC icon in the Control Panel... and I don't see any ODBC listed in the Services section from the Administrative Tools...) So... I was wondering if anybody know where I can download ODBC driver for W2K and WXP...

Okay... Let's just say that somebody gave me the link and I installed ODBC driver in my computer... I will be needing ADO set up so that I could actually call MS Access database with PHP... Am I right???

I have done several MySQL database job with PHP, but MS Access is the first time... Please correct me if I am wrong... With MySQL, the MySQL server should be running all the time, but there is no need of server in case of MS Access, am I right??? I just want to store the form data from the Flash to the MS Access database such as survey or contact form so that people can utilize that database later on...

Any help would be appreciated...
Thank you and have a nice day...
Jason
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-29-2003, 03:32 PM   #2
freddycodes
Master of Nothing
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
Default

Here is an example of how to do simple selects from MS Access with PHP implementing COM objects. I will leave it up to you to figure how to do inserts and updates.

PHP Code:
<?php
$db_conn 
= new COM("ADODB.Connection"); 
$connstr "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="realpath("./Northwind.mdb").";"
$db_conn->open($connstr); 
$rS $db_conn->execute("SELECT * FROM Employees"); 
$f1 =  $rS->Fields(0);
$f2 =  $rS->Fields(1);
while (!
$rS->EOF

    print 
$f1->value." ".$f2->value."<br />\n"
    
$rS->MoveNext(); 

$rS->Close(); 
$db_conn->Close(); 
?>
freddycodes is offline   Reply With Quote
Old 01-29-2003, 03:48 PM   #3
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,014
Default

Thank you, freddycodes, for the reply...

Basically I need to set up the ODBC first to get that script working, right??? Any idea where I can download that ODBC driver for W2K???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-29-2003, 03:57 PM   #4
freddycodes
Master of Nothing
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
Default

You don't need any ODBC. It's already there. this is an example of a DSN-less connection.
freddycodes is offline   Reply With Quote
Old 01-29-2003, 04:33 PM   #5
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,014
Default

Ha... Yes... It worked... Thank you...

Do you think this DSN-less connection would work the same way over the network??? I mean if I want to access the MS Access database that is sitting in the server...

I guess I have wasted 3 days looking for the ODBC driver... Stupid me...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-29-2003, 04:35 PM   #6
freddycodes
Master of Nothing
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
Default

If its on the same machine as the PHP script is on, this will work. Also be advised that in order for PHP to insert records to the database, the user running the php process needs write access to the file.

If its two separate machines just set up a new DSN for the datasource in the ODBC manager(part of windows). Nothing to download as far as I know.
freddycodes is offline   Reply With Quote
Old 09-22-2004, 12:45 PM   #7
operator
www.playfool.com
 
Join Date: Jul 2004
Location: London [UK]
Posts: 20
Default

I have been looking for an example for days thx freddycodes.
operator is offline   Reply With Quote
Old 09-23-2004, 02:43 AM   #8
Cota
Super Moderator
 
Cota's Avatar
 
Join Date: Jul 2001
Location: NYC
Posts: 10,107
Default

Just a few side notes for you CyanBlue, Access is very limited. For example, it will not support more than 4 concurrent connections, after that, everyone else gets locked out. Also, Access doesnt support all the "normal" SQL stuff, such as limited "join" statements. Be prepared for a headache with Access.
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 09-23-2004, 01:07 PM   #9
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,014
Default

Hehe... Thanks for the reply, Cota...
I've read the original question again and I don't know why I needed Access... Maybe I was just experimenting something... Can't remember what it was though...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 09-24-2004, 04:30 AM   #10
Cota
Super Moderator
 
Cota's Avatar
 
Join Date: Jul 2001
Location: NYC
Posts: 10,107
Default

I wish someone would have warned me before I started messing with Access......
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:30 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2010 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.