lux55 Posted September 20, 2009 Share Posted September 20, 2009 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 More sharing options...
PFMaBiSmAd Posted September 20, 2009 Share Posted September 20, 2009 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. Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921852 Share on other sites More sharing options...
lux55 Posted September 20, 2009 Author Share Posted September 20, 2009 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); ?> Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921854 Share on other sites More sharing options...
PFMaBiSmAd Posted September 20, 2009 Share Posted September 20, 2009 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? Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921857 Share on other sites More sharing options...
lux55 Posted September 20, 2009 Author Share Posted September 20, 2009 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. Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921863 Share on other sites More sharing options...
PFMaBiSmAd Posted September 20, 2009 Share Posted September 20, 2009 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 Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921871 Share on other sites More sharing options...
lux55 Posted September 20, 2009 Author Share Posted September 20, 2009 You rock! thanks so much! One day I hope to be tech-ish enough to pay it forward scriptwise. Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921875 Share on other sites More sharing options...
lux55 Posted September 21, 2009 Author Share Posted September 21, 2009 it was the underscore before POST... for anyone who might be having the same issue Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921984 Share on other sites More sharing options...
PFMaBiSmAd Posted September 21, 2009 Share Posted September 21, 2009 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. Link to comment https://forums.phpfreaks.com/topic/174925-solved-update-wont-update-from-flash/#findComment-921994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.