ZzzZ
12-10-2005, 05:52 PM
Hi,
I'm loading into flash, variables with php ,that were previously stored on a mysql database. Every variables show up in the flash movie, except the number of the present entry when someone browses through all entries. It always shows the total entries number and not the number of the entry that is being showed.
http://www.filipe.name/buttons.jpg
To explain better please follow the above link. The number on the right show the total entries. When we click the left arrow button the number on the left should be 5,4,and so on... The problem is it stays in the same number, in this case the number 6.
As I am a newbie both in php and flash I am not sure where the problem is...
In the first frame of the flash movie the code is this one:
function loadData() {
loadVariables("http://localhost/guestbook/read.php", "");
this.currN_txt.text = Number(this.myN);
This is the code for the left button:
on (release) {
_root.myN++;
if (_root.myN > _root.Records_txt.text) {
_root.myN = 0;
}
_root.Name_txt.variable = "arr_Name" add myN;
_root.Date_txt.variable = "arr_Date" add myN;
_root.Email_txt.variable = "arr_Email" add myN;
_root.Comment_txt.variable = "arr_Comment" add myN;
_root.presentRec_txt.text = Number(_root.presentRec_txt.text) - 1;
if (Number(_root.presentRec_txt.text) < 1) {
_root.presentRec_txt.text = Number(_root.recCount_txt.text);
}
The php script code is this one:
<?
// Connect to mySQL Server
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error());
// Select mySQL Database
mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$result = mysql_query("SELECT * FROM tblGuestBook order by fldUID DESC");
$allComments = $result;
$numallComments = mysql_num_rows($allComments);
$num = 0;
for ($num=0; $num < $numallComments; $num++)
while($row = mysql_fetch_row($result))
{ print "&ID$num={$row[0]}&arr_Name$num={$row[1]}&arr_Date$num={$row[2]}&{$row[3]}&arr_Email$num={$row[4]}&arr_URL$num={$row[5]}&arr_Comment$num={$row[6]}";
$num++;
}
print '&int_Records=' . $result . '&';
print '&present_Record=' . $numallComments . '&';
print '&total_Records=' . $numallComments . '&';
?>
int_Records is the var for Records_txt.
I bag your pardon for such a long post but at this moment I'm totaly lost and need help to find where the problem is. I´ve checked the action script code and get no errors... I think that the php script is not correct but don't know how to fix it. Can someone help me?
Tanks
I'm loading into flash, variables with php ,that were previously stored on a mysql database. Every variables show up in the flash movie, except the number of the present entry when someone browses through all entries. It always shows the total entries number and not the number of the entry that is being showed.
http://www.filipe.name/buttons.jpg
To explain better please follow the above link. The number on the right show the total entries. When we click the left arrow button the number on the left should be 5,4,and so on... The problem is it stays in the same number, in this case the number 6.
As I am a newbie both in php and flash I am not sure where the problem is...
In the first frame of the flash movie the code is this one:
function loadData() {
loadVariables("http://localhost/guestbook/read.php", "");
this.currN_txt.text = Number(this.myN);
This is the code for the left button:
on (release) {
_root.myN++;
if (_root.myN > _root.Records_txt.text) {
_root.myN = 0;
}
_root.Name_txt.variable = "arr_Name" add myN;
_root.Date_txt.variable = "arr_Date" add myN;
_root.Email_txt.variable = "arr_Email" add myN;
_root.Comment_txt.variable = "arr_Comment" add myN;
_root.presentRec_txt.text = Number(_root.presentRec_txt.text) - 1;
if (Number(_root.presentRec_txt.text) < 1) {
_root.presentRec_txt.text = Number(_root.recCount_txt.text);
}
The php script code is this one:
<?
// Connect to mySQL Server
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error());
// Select mySQL Database
mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$result = mysql_query("SELECT * FROM tblGuestBook order by fldUID DESC");
$allComments = $result;
$numallComments = mysql_num_rows($allComments);
$num = 0;
for ($num=0; $num < $numallComments; $num++)
while($row = mysql_fetch_row($result))
{ print "&ID$num={$row[0]}&arr_Name$num={$row[1]}&arr_Date$num={$row[2]}&{$row[3]}&arr_Email$num={$row[4]}&arr_URL$num={$row[5]}&arr_Comment$num={$row[6]}";
$num++;
}
print '&int_Records=' . $result . '&';
print '&present_Record=' . $numallComments . '&';
print '&total_Records=' . $numallComments . '&';
?>
int_Records is the var for Records_txt.
I bag your pardon for such a long post but at this moment I'm totaly lost and need help to find where the problem is. I´ve checked the action script code and get no errors... I think that the php script is not correct but don't know how to fix it. Can someone help me?
Tanks