Xtremer360 Posted May 23, 2010 Share Posted May 23, 2010 Okay so this is odd! I ran a form of mine and it went through sucessfully as I saw the echoed query, however, when I went into the database it didn't show the new row. How is that possible? Quote Link to comment https://forums.phpfreaks.com/topic/202631-non-existant-new-row-from-form-submission/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 23, 2010 Share Posted May 23, 2010 Your query failed to execute. Does your code have any error checking/error reporting/logging logic in it to get it to tell you when a query fails and to tell you why the query failed? Quote Link to comment https://forums.phpfreaks.com/topic/202631-non-existant-new-row-from-form-submission/#findComment-1062159 Share on other sites More sharing options...
Xtremer360 Posted May 24, 2010 Author Share Posted May 24, 2010 <?php $e = <<<here   <script src="./jscripts/scriptaculous/prototype.js" type="text/javascript"></script> <script src="./jscripts/scriptaculous/scriptaculous.js" type="text/javascript"></script> <script type="text/javascript" src="./jscripts/ajax.js"></script> here; switch ($_REQUEST['option']) { case 0: echo $e; ?>       <h1 class=backstage>Character Management</h1><br />       <h2 class=backstage>Characters :: <a href="#" onclick="ajaxpage('backstage_libs/character.php?option=1', 'content'); return false;">Add New</a></h2><br />       <?php       $query = "SELECT bio.id, bio.charactername, bio.username, bio.posername,s.name AS stylename, t.name AS statusname, a.name AS alignmentname FROM efed_bio AS bio, efed_list_styles AS s, efed_list_status AS t, efed_list_alignment AS a WHERE bio.style_id = s.id AND bio.status_id = t.id AND bio.alignment_id = a.id";            $result = mysql_query ( $query );       $rows = mysql_num_rows($result);   if ($rows > 0) { print'<table width="100%" class="table1">         <tr class="rowheading">           <td> </td>           <td> </td>           <td>Character Name</td>           <td align=center width=100>Poser Name</td>           <td align=center width=60>Style</td>           <td align=center width=60>Alignment</td>           <td align=center width=60>Status</td>         </tr>'; $i = 0; while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) { $sClass = 'row2'; if ($i++ % 2) $sClass = 'row1'; printf ( "<tr class=\"%s\">", $sClass );           print "<td valign=\"top\" align=center width=35><a href=\"#\" onclick=\"ajaxpage('backstage_libs/character.php?option=2&id=$row[id].', 'content'); return false;\">Edit</a></td>";           print "<td valign=\"top\" align=center width=25><a href=\"/backstage/bio.php?username=".$row['username']."\">Bio</a></td>";           printf ( "<td valign=\"top\">%s</td>", $row ['charactername'] );           printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['posername'] );           printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['stylename'] );           printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['alignmentname'] );           printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['statusname'] );           echo '</tr>';         } echo '</table><br>'; } else { echo '<span>There are no characters.</span><br />'; } returnmain(); footercode(); break; case 1: echo $e;       require_once('../backstageconfig.php'); require_once('../backstagefunctions.php'); ?>       <h1 class="backstage">Character Management</h1><br />       <h2 class="backstage">Add New Character</h2><br />       <form name="characters" method="post">         <input type="hidden" name="action" value="character" />         <table width="100%" class="table2">           <tr>             <td class="rowheading">Character Name:</td><td class="row3"><input type="text" name="charactername" class="fieldtext490" value=""></td>           </tr>           <tr>             <td width="120" class="rowheading">Username:</td><td class="row3"><input type="text" name="username" class="fieldtext160"></td>           </tr>           <tr>             <td width="120" class="rowheading">Poser name:</td><td class="row3"><input type="text" name="posername" class="fieldtext160" value=""></td>           </tr>           <tr>             <td class="rowheading">Style:</td><td class="row3">             <select name="style" class="selection">             <option value="0">- Select -</option>             <?php             $query = 'SELECT name,id FROM efed_list_styles';             $result = mysql_query ( $query );             while ( $row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$row['id']."\">".$row['name']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td class="rowheading">Gender:</td>             <td class="row3">             <select name="gender" class="selection">             <option value="0">- Select -</option><option value="Male">Male</option><option value="Female">Female</option>             </select></td>           </tr>           <tr>             <td class="rowheading">Status:</td><td class="row3">             <select name="status" class="selection">             <option value="0">- Select -</option>             <?php             $query = 'SELECT name,id FROM efed_list_status';             $result = mysql_query ( $query );             while ( $row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$row['id']."\">".$row['name']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td class=rowheading>Alignment:</td><td class="row3">             <select name="alignment" class="selection">             <option value="0">- Select -</option>             <?php             $query = 'SELECT name,id FROM efed_list_alignment';             $result = mysql_query ( $query );             while ( $row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$row['id']."\">".$row['name']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td class="rowheading">Sort:</td><td class="row3">             <select name="sort" class="selection">             <option value=0>- Select -</option><option value="A">A</option><option value="B">B</option><option value="C">C</option><option value="D">D</option><option value="E">E</option><option value="F">F</option><option value="G">G</option><option value="H">H</option><option value="I">I</option><option value="J">J</option><option value="K">K</option><option value="L">L</option><option value="M">M</option><option value="N">N</option><option value="O">O</option><option value="P">P</option><option value="Q">Q</option><option value="R">R</option><option value="S">S</option><option value="T">T</option><option value="U">U</option><option value="V">V</option><option value="W">W</option><option value="X">X</option><option value="Y">Y</option><option value="Z">Z</option><option value="0-9">0-9</option>             </select></td>           </tr>         </table><br />         <input type="hidden" name="newadded" value="true">         <input type="submit" value="Save Character" class="button"></form><br />         <form method="post"><input type="button" value="Return to Character List" class="button200" name="return">       </form><br />       <?php       returnmain();     break; case 2: echo $e;       require_once('../backstageconfig.php'); require_once('../backstagefunctions.php'); $id = $_GET['id']; $query = mysql_query("SELECT * FROM `efed_bio` WHERE `id` = '" . $id . "'"); $row = mysql_fetch_array($query); ?>       <h1 class="backstage">Character Management</h1><br />       <h2 class="backstage">Edit Character</h2><br />       <form name="characters" method="post">         <input type="hidden" name="action" value="character" />         <table width="100%" class="table2">           <tr>             <td class="rowheading">Character Name:</td><td class="row3"><input type="text" name="charactername" class="fieldtext490" value="<?php echo $row['charactername']; ?>"></td>           </tr>           <tr>             <td width="120" class="rowheading">Username:</td><td class="row3"><input type="text" name="username" class="fieldtext160" value="<?php echo $row['username']; ?>"></td>           </tr>           <tr>             <td width="120" class="rowheading">Poser name:</td><td class="row3"><input type="text" name="posername" class="fieldtext160" value="<?php echo $row['posername']; ?>"></td>           </tr>           <tr>             <td class="rowheading">Style:</td><td class="row3">             <select name="style" class="selection">             <option value="0">- Select -</option>             <?php             $query = 'SELECT * FROM efed_list_styles';             $result = mysql_query ( $query );             while ( $style_row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$style_row['id']."\" "; if($style_row['id'] == $row['style_id']) {               print " SELECTED";               } print ">".$style_row['name']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td class="rowheading">Gender:</td>             <td class="row3">             <select name="gender" class="selection">             <option value="0">- Select -</option> <?php               $gender = array('Male', 'Female'); foreach($gender as $gender):             ?>                  <option value="<?php echo $gender; ?>"<?php if($gender == $row['gender']): echo ' SELECTED'; endif; ?>><?php echo $gender; ?></option>                         <?php endforeach; ?>             </select></td>           </tr>           <tr>             <td class="rowheading">Status:</td><td class="row3">             <select name="status" class="selection">             <option value="0">- Select -</option>             <?php             $query = 'SELECT * FROM efed_list_status';             $result = mysql_query ( $query );             while ( $status_row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$status_row['id']."\" ";               if($status_row['id'] == $row['status_id']) {                 print " SELECTED";               }               print ">".$status_row['name']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td class=rowheading>Alignment:</td><td class="row3">             <select name="alignment" class="selection">             <option value="0">- Select -</option>             <?php             $query = 'SELECT * FROM efed_list_alignment';             $result = mysql_query ( $query );             while ( $alignment_row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$alignment_row['id']."\" ";               if($alignment_row['id'] == $row['alignment_id']) {                 print " SELECTED";               }               print ">".$alignment_row['name']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td class="rowheading">Sort:</td><td class="row3">             <select name="sort" class="selection">             <option value=0>- Select -</option> <?php               $sortorderarray=array(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,"0-9"); foreach($sortorderarray as $sortorderarray):             ?>                  <option value="<?php echo $sortorderarray; ?>"<?php if($sortorderarray == $row['sortorder']): echo ' SELECTED'; endif; ?>><?php echo $sortorderarray; ?></option>                         <?php endforeach; ?>             </select></td>           </tr>         </table><br />         <input type="hidden" name="editted" value="true"> <input type="hidden" name="oldcharactername" value="<?php echo $row['charactername']; ?>">         <input type="submit" value="Edit Character" class="button"></form><br />         <form method="post"><input type="button" value="Return to Character List" class="button200" name="return">       </form><br />       <?php       returnmain();     break; case 3: echo $e; $query = "SELECT s.hometown, s.height, s.weight,         h.kowtitles, h.kowawards,         w.nicknames, w.finisher, w.setup, w.music, w.manager_id     FROM `efed_bio_singles` AS s,        `efed_bio_history` AS h,        `efed_bio_wrestling` AS w     WHERE s.bio_id = '$defaultcharacterid' AND      h.bio_id = '$defaultcharacterid' AND      w.bio_id = '$defaultcharacterid'";  $result = mysql_query($query); $row = mysql_fetch_array($result); ?>       <h1 class=backstage>Character Management</h1><br />       <h2 class=backstage><?php echo $defaultcharactername; ?> - Personal</h2><br />       <form name="editcharacter" method="post"> <input type="hidden" name="action" value="character" />         <table width="100%" class="table2">           <tr>             <td width=120 class=rowheading>Hometown:</td><td class=row3>             <input type=text name="hometown" class=fieldtext490 value="<?php echo $row['hometown']; ?>"></td>           </tr>           <tr>             <td width=120 class=rowheading>Height:</td><td class=row3>             <input type=text name="height" class=fieldtext40 value="<?php echo htmlspecialchars($row['height']); ?>"></td>           </tr>           <tr>             <td width=120 class=rowheading>Weight:</td><td class=row3>             <input type=text name="weight" class=fieldtext80 value="<?php echo $row['weight']; ?>"></td>           </tr>         </table><br />         <h2 class=backstage>KOW Related</h2><br />         <table width="100%" class="table2">           <tr>             <td width=120 class=rowheading>KOW Titles:</td><td class=row3>             <input type=text name="kowtitles" class=fieldtext490 value="<?php echo $row['kowtitles']; ?>"></td>           </tr>           <tr>             <td width=120 class=rowheading>KOW Awards:</td><td class=row3>             <input type=text name="kowawards" class=fieldtext490 value="<?php echo $row['kowawards']; ?>"></td>           </tr>         </table><br />         <h2 class=backstage>Wrestling</h2><br />         <table width="100%" class="table2">           <tr>             <td width=120 class=rowheading>Nicknames:</td><td class=row3>             <input type=text name="nicknames" class=fieldtext490 value="<?php echo $row['nicknames']; ?>"></td>           </tr>           <tr>             <td width=120 class=rowheading>Manager:</td><td class=row3>             <select name="managerid" class=dropdown>             <option value="0">- Select -</option> <?php             $query = 'SELECT charactername,id FROM efed_bio WHERE style_id= 3 AND status_id=1';             $result = mysql_query ( $query );             while ( $manager_row = mysql_fetch_assoc ( $result ) )             {               print "<option value=\"".$manager_row['id']."\" ";               if($manager_row['id'] == $row['manager_id']) {                 print " SELECTED";               }               print ">".$manager_row['charactername']."</option>\r";             }             ?>             </select></td>           </tr>           <tr>             <td width=120 class=rowheading>Finisher Move:</td><td class=row3>             <input type=text name="finisher" class=fieldtext490 value="<?php echo htmlspecialchars($row['finisher']); ?>"></td>           </tr>           <tr>               <td width=120 class=rowheading>Setup Move:</td><td class=row3>               <input type=text name="setup" class=fieldtext490 value="<?php echo htmlspecialchars($row['setup']); ?>"></td>           </tr>           <tr>             <td width=120 class=rowheading>Entrance Music:</td><td class=row3>             <input type=text name="music" class=fieldtext490 value="<?php echo htmlspecialchars($row['music']); ?>"></td>           </tr>         </table><br /> <input type="hidden" name="defaultcharacterid" value="<?php echo $defaultcharacterid; ?>"> <input type="hidden" name="editted2" value="true">         <input type=submit value="Update Bio" class=button></form><br /> <?php returnmain(); footercode(); break; } function character() { $charactername = stripslashes(htmlspecialchars($_POST['charactername']));     $username = mysql_real_escape_string($_POST['username']);     $posername = mysql_real_escape_string($_POST['posername']);     $style = mysql_real_escape_string($_POST['style']);     $gender = mysql_real_escape_string($_POST['gender']);     $status = mysql_real_escape_string($_POST['status']);     $alignment = mysql_real_escape_string($_POST['alignment']);     $sort = mysql_real_escape_string($_POST['sort']); if ((!empty($_POST['newadded']))) { $query1 = "INSERT INTO `efed_bio` (charactername,username,posername,style_id,gender,status_id,alignment_id,sortorder) VALUES ('".$charactername."','".$username."','".$posername."','".$style."','".$gender."','".$status."','".$alignment."','".$sort."')"; mysql_query($query1);       $query1_id = mysql_insert_id();       $query2 = "INSERT INTO `efed_bio_allies` (bio_id) VALUES (".$query1_id.")";       mysql_query($query2);       $query3 = "INSERT INTO `efed_bio_rivals` (bio_id) VALUES (".$query1_id.")";       mysql_query($query3);       $query5 = "INSERT INTO `efed_bio_singles` (bio_id) VALUES (".$query1_id.")";       mysql_query($query5); } if ((!empty($_POST['editted']))) { $query = "UPDATE `efed_bio` SET `username` = '".$username."', `posername` = '".$posername."', `style_id` = '".$style."', `gender` = '".$gender."', `status_id` = '".$status."', `alignment_id` = '".$alignment."', `sortorder`='".$sort."' WHERE `charactername` = '".$charactername."'"; if(!mysql_query($query)){ echo mysql_error() . "<br />" . $query;} echo $query; } if ((!empty($_POST['editted2']))) { $kowtitles = mysql_real_escape_string($_POST['kowtitles']); $kowawards = mysql_real_escape_string($_POST['kowawards']); $height = ($_POST['height']); $weight = mysql_real_escape_string($_POST['weight']); $hometown = ($_POST['hometown']); $managerid = mysql_real_escape_string($_POST['managerid']); $nicknames = ($_POST['nicknames']); $finisher = ($_POST['finisher']); $setup = ($_POST['setup']); $music = ($_POST['music']); $defaultcharacterid = mysql_real_escape_string($_POST['defaultcharacterid']); $query = "UPDATE `efed_bio_history` SET `kowtitles` = '".$kowtitles."', `kowawards` = '".$kowawards."' WHERE bio_id = '$defaultcharacterid'"; if(!mysql_query($query)){ echo mysql_error() . "<br />" . $query;} $query2 = "UPDATE `efed_bio_singles` SET `height` = '".$height."', `hometown` = '".$hometown."', `weight` = '".$weight."' WHERE bio_id = '$defaultcharacterid'"; if(!mysql_query($query2)){ echo mysql_error() . "<br />" . $query2;} $query3 = "UPDATE `efed_bio_wrestling` SET `manager_id` = '".$managerid."', `nicknames` = '".$nicknames."', `finisher` = '".$finisher."', `setup` = '".$setup."', `music` = '".$music."' WHERE bio_id = '$defaultcharacterid'"; if(!mysql_query($query3)){ echo mysql_error() . "<br />" . $query3;} } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/202631-non-existant-new-row-from-form-submission/#findComment-1062670 Share on other sites More sharing options...
Xtremer360 Posted May 24, 2010 Author Share Posted May 24, 2010 No idea what I"m doing wrong Quote Link to comment https://forums.phpfreaks.com/topic/202631-non-existant-new-row-from-form-submission/#findComment-1062766 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.