-
Database help: Flash + Access DB w/ PHP?
How is this done? I've been experimenting a bit with PHP, but I have to admit I don't really know what I'm doing. I know PHP is more often used with MySQL, and Access with ASP, but I'm looking for PHP + Access. Do I need any sort of extra plugin type things to be able to do it?
Would I be able to test and see if its working locally simply by having the access database, php file, and .swf in the same directory? I've seen a fair number of tutorials online, but many are outdated, and many more are confusing and assume prior knowledge.
I want to start incredibly simple. For example, just show a single value from a database in a text field. I have experience using XML in Flash, so I don't need help there. It's all about understanding how the database works, how to set it up, how to test it, etc.
Here's the code I whipped up in the fla:
Code:
xmlLoader.load(new URLRequest("testxml.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void {
xml = XML(event.target.data);
xmlList = xml.children();
for(var i=0;i<xmlList.length();i++){
dText.text = xmlList[i];
}
}
So, basically, I need to learn how to set it up on my ftp server, or locally, to make it work, and I need to figure out how to write PHP code that will generate "testxml.xml" with values from the database.
The PHP might be something like this? Obviously it's not going to be MySQL, but I don't know how to set it up for Access.
Code:
<?php
$connect = mysql_connect("localhost", "root", "");
mysql_select_db("FlashDatabase");
$result = mysql_query("select * from Test");
// select all data from the Test table.
// now we are going to write this data into xml for flash
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
// front slash to skip inverted commas.
echo("<test>\n");
while($rows=mysql_fetch_assoc($result)){
echo("<item>". $rows['ValueTest'] ."</item>\n");
}
echo("</test>");
?>
Last edited by cilution; 01-13-2009 at 12:59 AM.
-
Senior Member
Moved to scripting and backend forum
- The right of the People to create Flash movies shall not be infringed. -
-
PHP and Microsoft Access:
http://www.google.com/search?hl=en&r...access&spell=1
The xml/php code looks fine.
-
I know how to Google. I posted here because what I found didn't seem to help me much, because it seemed like it assumed you already had a database on your server, everything set up, and more or less knew how to access it.
I don't know what I'm doing here. Most tutorials I'm finding are like "how to connect your database with Flash," when I need something more like "how to get your database set up on the web, and then how to use php to work with it, and then how to use php to make it work with Flash."
I assume there's more to it than simply uploading the .mdb and .php files? But maybe I'm wrong.
-
Hi,
if I understand things right, php supports ODBC for database connections. So if you run locally, you would probably have to configure your access file as a "data source"
If you dont plan to update your database with visitor input, how about exporting the data as csv and importing it into mysql or whatever is already present on your web space?
Musicman
-
I don't know if I have anything present on my webspace, at least, I haven't put anything on it. How do I go about doing that?
I would like to, at some point, be able to update the database from flash, whether its storing new values, or updating old ones, etc.
-
Hi,
are you sure that your webspace supports access (or microsoft sql server) at all? There is more webspace with mysql than anything else
Musicman
-
Not sure. I sort of got things working using localhost, but I have no idea how to take what I have working and get it on my website with the database and all. I got it working using mysql rather than access, for now.
-
Here's a PHP question.
How would I set up a PHP class that would take a single value in my database table and increment it by one? I'd like to attach it to a button in Flash.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|