[LEFT]I screwed up.
I have a php script that’s feeding me info from my database, and was working like a dream until I renamed and moved the PHP file (and adjusted my sendandload properties accordingly). Then it stopped working–it will read the file, but spit back the code instead of passing the variable. For example, instead of returning the text of $content, it spits back:
$content); } $query = “SELECT * FROM commonCont WHERE section=‘footer’”; $result = mysql_query($query); $numRow = mysql_num_rows($result); for($i=0; $i
It’ll write perfectly if I open the php in a browser window, and mysql is on and everything. Here’s the top of the PHP (I don’t think I need to toss in the whole file, right?):
<?php
function &connectToDb($host, $dbUser, $dbPass, $dbName)
{
// Make connection to MySQL server
if (!$dbConn = mysql_pconnect($host, $dbUser, $dbPass)) {
die('Could not connect to server');
}
// Select the database
if (!mysql_select_db($dbName, $dbConn)) {
die('Could not select database');
}
return $dbConn;
}
$host = 'localhost';
$dbUser = 'root';
$dbPass = 'root';
$dbName = 'RMH';
$dbConn = &connectToDb($host, $dbUser, $dbPass, $dbName);
print("Yea");
?>
<!-- Start Accessing Data! Whoo -->
<?php
// COMMON CONTENT
if (isset($HTTP_POST_VARS['common'])){
$query = "SELECT * FROM commonCont WHERE section='introText'";
$result = mysql_query($query);
$numRow = mysql_num_rows($result);
for($i=0; $i<$numRow; $i++){
$row = mysql_fetch_array($result);
$content = $row['content'];
print("&introText=$numRow" . $content);
}
$query = "SELECT * FROM commonCont WHERE section='footer'";
$result = mysql_query($query);
$numRow = mysql_num_rows($result);
for($i=0; $i<$numRow; $i++){
$row = mysql_fetch_array($result);
$content = $row['content'];
print("&footer=" . $content);
}
}
And the actionscript:
function
showCommon() {
footer.htmlText = "<footer>" + sendPHP['footer'] + "</footer>";
mainText.htmlText = "<mainBlock><textformat leading='10' align='center'>" + sendPHP['introText'] + "</textformat></mainBlock>";
photo = contHolder.attachMovie("photoRect", "photo", realDepth(contHolder), {_x:mainText_X, _y:mainText_Y-10, _width:mainText_Width-5, _height:100});
queryFile = 'phpScripts/content.php';
sendPHP.onLoad = showCommon;
sendPHP.common = true;
sendPHP.sendAndLoad(queryFile, sendPHP, "POST");
}
]
[/LEFT]