Okay, I have come down to the wire and I am at a complete loss. I have a project due and to make a long story short (no lectures on this aspect of my problem please, I have already beate myself up over it)---I had to develop without the server/hosting information due to retarded clients. Any, I have a Flash project that uses a MySql database via PHP. It works perfectly on servers that have the PHP in Apache. I end up with PHP running as CGI. No problem, I think. I change what needed to be changed and it wouldn't work. After a week of pulling my hair out and bugging the support department they recompile something and install the newest version of PHP and it works! Or so I thought. I was only testing the "fetching" script which pulls from the database for display in the SWF. It works. I thought that I was in the clear. Wrong. My SWF won't send the content of the variable to the database. The script runs, but it is making an empty entry. The damned things work on any of the three other servers that I have tested it on, but not this. So.....if anyone out there has any experience with this or can direct me to someplace that they know for sure would have the information, then please please do. I had gotten my base scripting of this from PHP for Flash, but I can't find anything that helps.
I am including my php code for retrieving information from the database (which works) and my code for inserting into the database (which executes, but doesn't pass the varible information). I am also including my ActionScript code and the guidelines set down by the hosting company for use of PHP on their server. I have the PHP scripts outside of the cgi-bin, but with the cgi exstension and a permissions setting of 755. I know that the scripts are executing because when I run them from a browser they send a blank entry into the database also (as in when used in the SWF also). fetchdefaultTableName.cgi------------------------- #!/usr/local/bin/php <?php $dbHost = "mysql.hostname.com"; $dbUser = "username"; $dbPass = "password"; $dbName = "databasename"; $link = @mysql_connect($dbHost, $dbUser, $dbPass); if (!$link) { print "Could not connect to server"; exit; } if (!@mysql_select_db($dbName)) { // Report error to Flash and exit print "Could not select $dbName database"; exit; } $query = "SELECT newsText FROM tablenamedefault ORDER BY updateID DESC LIMIT 1"; $result = @mysql_query($query); if ($result && @mysql_num_rows($result) > 0) { $newsText = ""; while($row = mysql_fetch_array($result)) { $posted = strftime("%a %d/%m/%y %H:%M", $row['posted']); $newsText .= stripslashes($row['newsText']) . ''; } print "&newsText=" . urlencode($newsText); } else { print "No new items yet"; } mysql_close($link); ?> updatedefaultTableName.cgi----------------------- #!/usr/local/bin/php <?php $dbHost = "mysql.hostname.com"; $dbUser = "username"; $dbPass = "password"; $dbName = "databasename"; $link = @mysql_connect($dbHost, $dbUser, $dbPass); if (!$link) { print "Could not connect to server"; exit; } if (!@mysql_select_db($dbName)) { print "Could not select $dbName database"; exit; } $posted = time(); $query = "INSERT INTO tablenamedefault (newsText, posted) VALUES('$newsText', $posted)"; $result = @mysql_query($query); if ($result) { print "Success"; } else { print "Couldn't add item"; } mysql_close($link); ?> Flash ActionScripting: Code that contains the posting info for display in the SWF (and it works fine): _root.clearNewsText(); _root.generateText(); newsText = ""; loadVariables("http://www.url.com/fetchdefaultTableName.cgi?"+(Math.random()*1000000), _root.newsText, "POST"); stop(); Code that contains the posting info for input: on (release) { _root.sendTextUpdate(); loadVariables("http://www.url.com/updatedefaultTableName.cgi"), _root.newsTextHolder, "POST"); } WebHosting Facts: We do support PHP scripting, but it is not built into the web server. What this means is that you can execute PHP code like you would execute C or Perl code, as a CGI script. You will not be able to use the PHP "includes" or "extensions" however. If you wish to use it, be sure to put your file/s in your cgi-bin. If a CGI script is not in the cgi-bin/ directory, the file must end in .cgi. It also must be set executable and it needs to have the standard #!/path/to/interpreter reference on the first line of the file. The path to PHP is /usr/local/bin/php. The current version installed (from the -v flag) is: 4.0.2 Sorry for the redundancy, but I wanted to make sure that I was understood and didn't leave anything out for you gurus out there. Show me the way to your infinate light and wisdom ;) Rebekah Garner