MediaGord Posted August 17, 2009 Share Posted August 17, 2009 Hi, does anyone see anything wrong with this code off hand? I've tried many different ways and it still doesn't want to go into my database. I quadruple checked the database name and info. My best guess is that it's the variables. Possibly the variables I am getting from Flash aren't posting correctly? When I do a trace in Flash it says that the sendAndLoad is working. Anyways let me get your thoughts if your interested. Thanks. <?php $fname = $_POST['fname']; $lname = $_POST['lname']; $cname = $_POST['cname']; $address = $_POST['address']; $phone = $_POST['phone']; $email = $_POST['email']; $logo_yes_no = $_POST['logo_yes_no']; $font_yes_no = $_POST['font_yes_no']; $fontchoice = $_POST['fontchoice']; $bannerchoice = $_POST['bannerchoice']; $navchoice = $_POST['navchoice']; $colorchoice = $_POST['colorchoice']; $templatechoice = $_POST['templatechoice']; $gallerychoice = $_POST['gallerychoice']; $homewrite = $_POST['homewrite']; $aboutwrite = $_POST['aboutwrite']; DEFINE ('DB_USER', 'dbusername'); // Insert your database username into the quotes. DEFINE ('DB_PASSWORD', 'dbpassword'); // Insert your database password into the quotes. DEFINE ('DB_HOST', 'dbhost'); // This will most likely stay the same. DEFINE ('DB_NAME', 'dbname'); //Insert your actual database name in the quotes. $dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error()); //@ is to o not show errors on the page @mysql_select_db (DB_NAME) OR die('Could not select the database: ' . mysql_error() ); $query="INSERT INTO form_data (fname, lname, cname, address, phone, email, logo_yes_no, font_yes_no, fontchoice, bannerchoice, navchoice, colorchoice, templatechoice, gallerychoice, homewrite, aboutwrite) VALUES ('$fname', '$lname', '$cname', '$address', '$phone', '$email', '$logo_yes_no', '$font_yes_no', '$fontchoice', '$bannerchoice', '$navchoice', '$colorchoice', '$templatechoice', '$gallerychoice', '$homewrite', '$aboutwrite')"; //form_data is the name of the MySQL table where the form data will be saved. $numR = mysql_num_rows($sql); echo "Database updated with: $fname "; ?> Quote Link to comment https://forums.phpfreaks.com/topic/170729-solved-flash-to-php-to-database-variables-not-inserting-any-experts-in-this-out-there/ Share on other sites More sharing options...
heldenbrau Posted August 17, 2009 Share Posted August 17, 2009 sometimes when this happens to me, it is because I have copied a form from another page and forgotten to change the action= value to the new php file. Quote Link to comment https://forums.phpfreaks.com/topic/170729-solved-flash-to-php-to-database-variables-not-inserting-any-experts-in-this-out-there/#findComment-900462 Share on other sites More sharing options...
MediaGord Posted August 17, 2009 Author Share Posted August 17, 2009 I'm sending the variables from Flash though and the php link is correct, here's the flash code so far: //Send and Load variables var form_process:LoadVars = new LoadVars(); send_btn.onRelease = function() { var post_variable:LoadVars = new LoadVars(); post_variable.fname = fname_txt.text; post_variable.lname = lname_txt.text; post_variable.cname = cname_txt.text; post_variable.address = address_txt.text; post_variable.phone = phone_txt.text; post_variable.email = email_txt.text; post_variable.logo_yes_no = logo_yes_no; post_variable.font_yes_no = font_yes_no; post_variable.fontchoice = fontchoice; post_variable.bannerchoice = bannerchoice; post_variable.navchoice = navchoice; post_variable.colorchoice = colorchoice; post_variable.templatechoice = templatechoice; post_variable.gallerychoice = gallerychoice; post_variable.homewrite = homewrite_txt.text; post_variable.aboutwrite = aboutwrite_txt.text; post_variable.sendAndLoad("http://www.mediagord.com/yellowday/form/form.php",form_process,"POST"); }; form_process.onLoad = function(success:Boolean) { if (success) { trace("Neeeee Haaaaawwwwwwwww!!!!!!!"); } else { results_txt.text = "Error connecting to server."; } }; Quote Link to comment https://forums.phpfreaks.com/topic/170729-solved-flash-to-php-to-database-variables-not-inserting-any-experts-in-this-out-there/#findComment-900485 Share on other sites More sharing options...
.josh Posted August 18, 2009 Share Posted August 18, 2009 Most immediate thing I see is that you are not actually sending the query to the database. All you are doing is assigning your query string to a variable. You need to send it to the db with something like mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/170729-solved-flash-to-php-to-database-variables-not-inserting-any-experts-in-this-out-there/#findComment-900538 Share on other sites More sharing options...
MediaGord Posted August 18, 2009 Author Share Posted August 18, 2009 I see what you mean. Sort of new to this. I'll tinker around and let you know what I come up with, thanks for the advice :-) Quote Link to comment https://forums.phpfreaks.com/topic/170729-solved-flash-to-php-to-database-variables-not-inserting-any-experts-in-this-out-there/#findComment-900594 Share on other sites More sharing options...
MediaGord Posted August 18, 2009 Author Share Posted August 18, 2009 Great! that's exactly what I was missing. Thanks very much :-) Quote Link to comment https://forums.phpfreaks.com/topic/170729-solved-flash-to-php-to-database-variables-not-inserting-any-experts-in-this-out-there/#findComment-900617 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.