cdoggg94 Posted November 30, 2012 Share Posted November 30, 2012 this is the update script dreamweaver created after i was done inputting the values: $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "numberEdit")) { $updateSQL = sprintf("UPDATE admin_quote_numbers SET num_fiestaPercent=%s, num_totalVisit=%s, num_madAdmin=%s, num_percentManAdmin=%s, num_visitFee=%s, num_visitPerDay=%s, num_hourPerDay=%s, num_gasCostPerDay=%s, num_costPerDay=%s, num_smallMaint=%s, num_costPerYear=%s, num_speader=%s, num_tank=%s, num_wand=%s, num_INScostPerYear=%s, num_vechileCostPerYear=%s, num_liabilityINS=%s, num_man1=%s, num_man2=%s, num_fiestsa=%s, num_fert=%s, num_corn=%s, num_cornMark=%s, num_sea=%s, num_seaMark=%s, num_seed=%s, num_seedMark=%s, num_gurb=%s, num_grubMark=%s, num_aeration=%s, num_aerationMark=%s, num_totalMark=%s WHERE num_id=%s", GetSQLValueString($_POST['fiestaPercent'], "text"), GetSQLValueString($_POST['totalVisits'], "text"), GetSQLValueString($_POST['madAdmin'], "text"), GetSQLValueString($_POST['perManAdmin'], "text"), GetSQLValueString($_POST['visitFee'], "text"), GetSQLValueString($_POST['visitsPerDay'], "text"), GetSQLValueString($_POST['hoursPerDay'], "text"), GetSQLValueString($_POST['gasPerDay'], "text"), GetSQLValueString($_POST['costPerDay'], "text"), GetSQLValueString($_POST['smallMaint'], "text"), GetSQLValueString($_POST['costPerYear'], "text"), GetSQLValueString($_POST['speader'], "text"), GetSQLValueString($_POST['tank'], "text"), GetSQLValueString($_POST['wands'], "text"), GetSQLValueString($_POST['insCostPerYear'], "text"), GetSQLValueString($_POST['vehicleCostPerYear'], "text"), GetSQLValueString($_POST['liabilityINS'], "text"), GetSQLValueString($_POST['man1'], "text"), GetSQLValueString($_POST['man2'], "text"), GetSQLValueString($_POST['fiesta'], "text"), GetSQLValueString($_POST['fert'], "text"), GetSQLValueString($_POST['corn'], "text"), GetSQLValueString($_POST['cornMark'], "text"), GetSQLValueString($_POST['sea'], "text"), GetSQLValueString($_POST['seaMark'], "text"), GetSQLValueString($_POST['seed'], "text"), GetSQLValueString($_POST['seedMark'], "text"), GetSQLValueString($_POST['grub'], "text"), GetSQLValueString($_POST['grubMark'], "text"), GetSQLValueString($_POST['aeration'], "text"), GetSQLValueString($_POST['aerationMark'], "text"), GetSQLValueString($_POST['totalMark'], "text"), GetSQLValueString($_POST['id'], "int")); mysql_select_db($database_jodyConnect, $jodyConnect); $Result1 = mysql_query($updateSQL, $jodyConnect) or die(mysql_error()); $updateGoTo = "admin_quote_numbers.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } this is my form: <form action="<?php echo $editFormAction; ?>" method="POST" id="numberEdit" name="numberEdit"> <table border="0"> <tr> <td align="right">Fiesta %:</td> <td><input name="fiestaPercent" id="fiestaPercent" type="text" value="<?php echo $row_Numbers['num_fiestaPercent'] ;?>" /></td> </tr> <tr> <td align="right">Total Visits:</td> <td><input name="totalVisits" id="totalVisits" type="text" value="<?php echo $row_Numbers['num_totalVisit'] ;?>" /></td> </tr> <tr> <td align="right">Mad Admin:</td> <td><input name="madAdmin" id="madAdmin" type="text" value="<?php echo $row_Numbers['num_madAdmin'] ;?>" /></td> </tr> <tr> <td align="right">% of Man/Admin:</td> <td><input name="perManAdmin" id="perManAdmin" type="text" value="<?php echo $row_Numbers['num_percentManAdmin'] ;?>" /></td> </tr> <tr> <td align="right">visitFee:</td> <td><input name="visitFee" id="visitFee" type="text" value="<?php echo $row_Numbers['num_visitFee'] ;?>" /></td> </tr> <tr> <td align="right">Visits/Day:</td> <td><input name="visitsPerDay" id="visitsPerDay" type="text" value="<?php echo $row_Numbers['num_visitPerDay'] ;?>" /></td> </tr> <tr> <td align="right">Hours/Day:</td> <td><input name="hoursPerDay" id="hoursPerDay" type="text" value="<?php echo $row_Numbers['num_hourPerDay'] ;?>" /></td> </tr> <tr> <td align="right">Gas Cost/Day:</td> <td><input name="gasPerDay" id="gasPerDay" type="text" value="<?php echo $row_Numbers['num_gasCostPerDay'] ;?>" /></td> </tr> <tr> <td align="right">Cost/Day:</td> <td><input name="costPerDay" id="costPerDay" type="text" value="<?php echo $row_Numbers['num_costPerDay'] ;?>" /></td> </tr> <tr> <td align="right">Small Maint:</td> <td><input name="smallMaint" id="smallMaint" type="text" value="<?php echo $row_Numbers['num_smallMaint'] ;?>" /></td> </tr> <tr> <td align="right">Cost/Year:</td> <td><input name="costPerYear" id="costPerYear" type="text" value="<?php echo $row_Numbers['num_costPerYear'] ;?>" /></td> </tr> <tr> <td align="right">Speader:</td> <td><input name="speader" id="speader" type="text" value="<?php echo $row_Numbers['num_speader'] ;?>" /></td> </tr> <tr> <td align="right">Tank:</td> <td><input name="tank" id="tank" type="text" value="<?php echo $row_Numbers['num_tank'] ;?>" /></td> </tr> <tr> <td align="right">Wands:</td> <td><input name="wands" id="wands" type="text" value="<?php echo $row_Numbers['num_wand'] ;?>" /></td> </tr> <tr> <td align="right">Ins Cost/Year:</td> <td><input name="insCostPerYear" id="insCostPerYear" type="text" value="<?php echo $row_Numbers['num_INScostPerYear'] ;?>" /></td> </tr> <tr> <td align="right">Vehicle Cost/Year:</td> <td><input name="vehicleCostPerYear" id="vehicleCostPerYear" type="text" value="<?php echo $row_Numbers['num_vechileCostPerYear'] ;?>" /></td> </tr> <tr> <td align="right">Liability Ins/Year:</td> <td><input name="liabilityINS" id="liabilityINS" type="text" value="<?php echo $row_Numbers['num_liabilityINS'] ;?>" /></td> </tr> <tr> <td align="right">Man 1:</td> <td><input name="man1" id="man1" type="text" value="<?php echo $row_Numbers['num_man1'] ;?>" /></td> </tr> <tr> <td align="right">Man 2:</td> <td><input name="man2" id="man2" type="text" value="<?php echo $row_Numbers['num_man2'] ;?>" /></td> </tr> <tr> <td align="right">Fiesta:</td> <td><input name="fiesta" id="fiesta" type="text" value="<?php echo $row_Numbers['num_fiestsa'] ;?>" /></td> </tr> <tr> <td align="right">Fert:</td> <td><input name="fert" id="fert" type="text" value="<?php echo $row_Numbers['num_fert'] ;?>" /></td> </tr> <tr> <td align="right">Corn Gluten Meal:</td> <td><input name="corn" id="corn" type="text" value="<?php echo $row_Numbers['num_corn'] ;?>" /></td> </tr> <tr> <td align="right">Corn Gluten Mark Up:</td> <td><input name="cornMark" id="cornMark" type="text" value="<?php echo $row_Numbers['num_cornMark'] ;?>" /></td> </tr> <tr> <td align="right">Sea Kelp:</td> <td><input name="sea" id="sea" type="text" value="<?php echo $row_Numbers['num_sea'] ;?>" /></td> </tr> <tr> <td align="right">Sea Kelp Mark Up:</td> <td><input name="seaMark" id="seaMark" type="text" value="<?php echo $row_Numbers['num_seaMark'] ;?>" /></td> </tr> <tr> <td align="right">Seed 1:</td> <td><input name="seed" id="seed" type="text" value="<?php echo $row_Numbers['num_seed'] ;?>" /></td> </tr> <tr> <td align="right">Seed 1 Mark Up:</td> <td><input name="seedMark" id="seedMark" type="text" value="<?php echo $row_Numbers['num_seedMark'] ;?>" /></td> </tr> <tr> <td align="right">Grubs:</td> <td><input name="grub" id="grub" type="text" value="<?php echo $row_Numbers['num_gurb'] ;?>" /></td> </tr> <tr> <td align="right">Grub Mark Up:</td> <td><input name="grubMark" id="grubMark" type="text" value="<?php echo $row_Numbers['num_grubMark'] ;?>" /></td> </tr> <tr> <td align="right">Aeration:</td> <td><input name="aeration" id="aeration" type="text" value="<?php echo $row_Numbers['num_aeration'] ;?>" /></td> </tr> <tr> <td align="right">Aeration Mark Up:</td> <td><input name="aerationMark" id="aerationMark" type="text" value="<?php echo $row_Numbers['num_aerationMark'] ;?>" /></td> </tr> <tr> <td align="right">Total Mark Up:</td> <td><input name="totalMark" id="totalMark" type="text" value="<?php echo $row_Numbers['num_totalMark'] ;?>" /></td> </tr> <tr> <td align="right"> <input id="id" name="id" type="hidden" value="<?php echo $row_Numbers['id'] ;?>" /> </td> <td><input name="submit" value="Save" type="submit" /></td> </tr> </table> <input type="hidden" name="MM_update" value="numberEdit" /> </form> basically when i hit save it doesnt update..almost as i i was missing a value(i have checked several times to make sure they were all there) or as if the submit button was not submitting...very strange...i used this way because it generally quicker then typing out one by hand...especially a long one like this. does anyone have any suggestions ? Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 30, 2012 Share Posted November 30, 2012 Is it safe to say that $jodyConnect has been set at some point? I don't see it in your code (should be your mysql_connect())? If you echo $updateSQL, are you getting expected results? Is your script reaching the query? Or is that initial condition failing? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 30, 2012 Share Posted November 30, 2012 Are you sure about the id form field value coming from $row_Numbers['id']? That doesn't match the other $row_Numbers field name format and it doesn't match the column name the submitted id is being compared against in the update query. Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted November 30, 2012 Author Share Posted November 30, 2012 (edited) Yes $jodyConnect is set and working fine Nothing is displayed when I echo #updateSQL. It seems like the initial condition is failing almost...Nothing really happens.. Edited November 30, 2012 by cdoggg94 Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 30, 2012 Share Posted November 30, 2012 (edited) It updates for me. Yes $jodyConnect is set and working fine Nothing is displayed when I echo #updateSQL. It seems like the initial condition is failing almost...Nothing really happens.. It updates for me at the link you provided. Edited November 30, 2012 by mrMarcus Quote Link to comment Share on other sites More sharing options...
cdoggg94 Posted November 30, 2012 Author Share Posted November 30, 2012 yea i think its because i just put the correct value in for my id... thank you both for you help ! Quote Link to comment 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.