igx
04-21-2003, 04:39 AM
Dear Expert Friend,
1. I am making a Flash form with connection to PhP for a process.
2. The name of the dynamic text box in the form is
inputlastname
3. The Process intended, is to open MySQL database and to
DELETE a data - specified in the Flash form.
4. So far the process is Good and Well Done. The data in MySQL
is erased as wished.
5. The process is smooth and successful.
The minor problems are that :
1. I have 2 types of PhP file. one always gives back forever "OK"
signal to Flash no matter whether the process is correct or
incorrect, and the other one always gives back forever "NO"
signal to Flash no matter whether the process is correct or
incorrect.
2. This is important eversince, if the reply is detected as "OK", it
will then gotoAndStop(framenumber) to a proper destination
framenumber to display OK result. So does with the "NO" reply
if it is detected so.
---------------------------------------------------------------------
Below, I enclose you my codes :
---------------------------------------------------------------------
The FOREVER "OK - SUCCESS" RESULT VERSION :
<?php
mysql_connect("localhost","user","password");
mysql_select_db("dbname");
$r=md5($inputlastname);
$del_str = "DELETE FROM pinrec WHERE thename = '$r'";
if (mysql_query ($del_str))
{
$x="ok";
echo "&x=$x";
}
else
{
$x="no";
echo "&x=$x";
}
?>
-----------------------------------------------------------------------
The FOREVER "NO - FAIL" RESULT VERSION:
In this version, I try to FILTER and SEEK first whether the data in MySQL is exist, and if it's not, I want it to flag "NO", if it's exist, I want it to DELETE the data directly and then to flag "OK". But, as always, it fails.
<?php
mysql_connect("localhost","user","password");
mysql_select_db("dbname");
$r=md5($inputlastname);
$stepone=mysql_query("SELECT * FROM pinrec WHERE thename='$r'");
$steptwo=mysql_affected_rows($stepone);
$gogogogo=mysql_query($steptwo);
if ($gogogogo)
{
$del_str = mysql_query("DELETE FROM pinrec WHERE
thename= '$r'");
echo "x=ok";
}
else
{
echo "x=no";
}
}
?>
-------------------------------------------------------------------
I also have new suspicion of bug in those above.
It seems to me that it doesn't always TOUCH the process of reading the "ELSE" written downthere, meaning the Conditional process instruction is not read completely by the PhP / MySQL. Thus, it never knows what to say if x is to be said as "no".
The First type of Forever "OK - Success" code is more fruitful :
if (mysql_query ($del_str)) {
$x="ok";
echo "&x=$x";
}
else
{
$x="no";
echo "&x=$x";
}
that x will say signal "ok". Forever - no matter correct or incorrect
BUT,
$del_str = mysql_query("DELETE FROM pinrec WHERE thename='$r'");
echo "x=ok";
}
else
{
echo "x=no";
}
this x will carry signal "no". Forever - no matter correct or incorrect
And I have another suspicion.
This time is in the Flash Side coding :
on (release)
{
myVars = new LoadVars();
myVars.inputlastname = inputlastname.text;
myVars.sendAndLoad('delete.php', myVars, 'POST');
myVars.onfiltered= function()
{
if (this.x == 'ok') <-----||| ESPECIALLY IN HERE !!!
I HAVE SUSPICION IN HERE !!!
{
gotoAndStop(38); // if the MySQL Data just been deleted
}
else
{
gotoAndStop(39); // if the MySQL Data is none to find
}
}
}
It can also have possibility that the PhP / MySQL process is actually Completely Thorough, but because of wrong coding in the Flash Side, I always get wrongly diverted to an unwanted frame number.
I also have make the frame a bit longer about 36 frame more, to allow the Flash SendandLoad process completely done.
Please kindly help me.
Thank you. Thank you.
Yours Sincerely,
- IGX
:(
1. I am making a Flash form with connection to PhP for a process.
2. The name of the dynamic text box in the form is
inputlastname
3. The Process intended, is to open MySQL database and to
DELETE a data - specified in the Flash form.
4. So far the process is Good and Well Done. The data in MySQL
is erased as wished.
5. The process is smooth and successful.
The minor problems are that :
1. I have 2 types of PhP file. one always gives back forever "OK"
signal to Flash no matter whether the process is correct or
incorrect, and the other one always gives back forever "NO"
signal to Flash no matter whether the process is correct or
incorrect.
2. This is important eversince, if the reply is detected as "OK", it
will then gotoAndStop(framenumber) to a proper destination
framenumber to display OK result. So does with the "NO" reply
if it is detected so.
---------------------------------------------------------------------
Below, I enclose you my codes :
---------------------------------------------------------------------
The FOREVER "OK - SUCCESS" RESULT VERSION :
<?php
mysql_connect("localhost","user","password");
mysql_select_db("dbname");
$r=md5($inputlastname);
$del_str = "DELETE FROM pinrec WHERE thename = '$r'";
if (mysql_query ($del_str))
{
$x="ok";
echo "&x=$x";
}
else
{
$x="no";
echo "&x=$x";
}
?>
-----------------------------------------------------------------------
The FOREVER "NO - FAIL" RESULT VERSION:
In this version, I try to FILTER and SEEK first whether the data in MySQL is exist, and if it's not, I want it to flag "NO", if it's exist, I want it to DELETE the data directly and then to flag "OK". But, as always, it fails.
<?php
mysql_connect("localhost","user","password");
mysql_select_db("dbname");
$r=md5($inputlastname);
$stepone=mysql_query("SELECT * FROM pinrec WHERE thename='$r'");
$steptwo=mysql_affected_rows($stepone);
$gogogogo=mysql_query($steptwo);
if ($gogogogo)
{
$del_str = mysql_query("DELETE FROM pinrec WHERE
thename= '$r'");
echo "x=ok";
}
else
{
echo "x=no";
}
}
?>
-------------------------------------------------------------------
I also have new suspicion of bug in those above.
It seems to me that it doesn't always TOUCH the process of reading the "ELSE" written downthere, meaning the Conditional process instruction is not read completely by the PhP / MySQL. Thus, it never knows what to say if x is to be said as "no".
The First type of Forever "OK - Success" code is more fruitful :
if (mysql_query ($del_str)) {
$x="ok";
echo "&x=$x";
}
else
{
$x="no";
echo "&x=$x";
}
that x will say signal "ok". Forever - no matter correct or incorrect
BUT,
$del_str = mysql_query("DELETE FROM pinrec WHERE thename='$r'");
echo "x=ok";
}
else
{
echo "x=no";
}
this x will carry signal "no". Forever - no matter correct or incorrect
And I have another suspicion.
This time is in the Flash Side coding :
on (release)
{
myVars = new LoadVars();
myVars.inputlastname = inputlastname.text;
myVars.sendAndLoad('delete.php', myVars, 'POST');
myVars.onfiltered= function()
{
if (this.x == 'ok') <-----||| ESPECIALLY IN HERE !!!
I HAVE SUSPICION IN HERE !!!
{
gotoAndStop(38); // if the MySQL Data just been deleted
}
else
{
gotoAndStop(39); // if the MySQL Data is none to find
}
}
}
It can also have possibility that the PhP / MySQL process is actually Completely Thorough, but because of wrong coding in the Flash Side, I always get wrongly diverted to an unwanted frame number.
I also have make the frame a bit longer about 36 frame more, to allow the Flash SendandLoad process completely done.
Please kindly help me.
Thank you. Thank you.
Yours Sincerely,
- IGX
:(