Jump to content

[SOLVED] UPDATE won't update from flash...


lux55

Recommended Posts

here is my php script...

 

$query = "UPDATE `news2_voyeurmembers`.`members` SET `phone` = '$phone' WHERE `members`.`id` ='$id'" ;

$result = mysql_query($query);

 

 

//success

if (mysql_query($query)) {

//inform of this success

print "&statust=Update successful.";

} else {

 

//otherwise report error

print "&statust=Information NOT Updated please call us";

}

 

when I run the script alone- I get "Update successful" message and when I run flash file I get no errors in activity viewer.

 

my variables phone and id are in the swf file...

 

I tried loadVariables and loadVariablesNum, even tried sendAndLoad

 

the record will not update.

 

any ideas?

need more info?

 

 

Link to comment
https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/
Share on other sites

my variables phone and id are in the swf file...
... which is executed in the client. What method is being used to submit those to the web server and where is your php code that is getting those from the proper $_POST or $_GET variables (depending on method.)

 

Php program variables like $phone and $id don't magically appear in your php script without something in between the client that is sending them and the program variables themselves.

first thanks for answering...

 

<?php

$phone=$POST["phone"];

$id=$POST["id"];

 

$Host = "localhost";

$User = "";

$Password = "";

$DBName = "news2_voyeurmembers";

$TableName = "members";

 

$Link = mysql_connect ($Host, $User, $Password);

 

 

//build query

 

 

$query = "UPDATE `news2_voyeurmembers`.`members` SET `phone` = '$phone' WHERE `members`.`id` ='$id'" ;

$result = mysql_query($query);

 

 

//success

if (mysql_query($query)) {

//inform of this success

print "&statust=Update successful.";

} else {

 

//otherwise report error

print "&statust=Information NOT Updated please call us";

}

mysql_close ($Link);

?>

 

And you have echoed those variables or the whole $query variable so that you know they contain what you expect and there is a row in your table with a matching id value?

 

I echoed the output by changing it to GET and set level to "this" which opened up another window... in the url is this alterrecord.php?%5FsearchKey=21221&address1=+vine+street%0A&address2=apt+2A%0A&city=Philadelphia%0A&tstate=PA%0A&zip=19106%0A&licnumber=%0A&sex=%0A&phone=hhhthtrhjrthj%0D&licexp=%0A&comments=add+some+words+to+read%0A&occupation=hostess%0A&country=United+States%0A&membertype=social%0A&sponsor=%0A&feepaid=20%0A&emailaddy=tash515%40hotmail%2Ecom%0A&id=4%0A%0A

 

 

it looks like a lotta garbage! This: %5FsearchKey=21221 has me perplexed because I have nothing called SearchKey in my flash file.

Without a $_POST['id'] to tell the query which row to update, the query will execute correctly, but since the WHERE clause is FALSE it won't actually update anything. To test if the query actually changed a row, you need to use mysql_affected_rows

Lol, I missed seeing that in your original code, which is why you should always develop and debug php code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini to get php to help you find things like variables that don't exist.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.