dennismonsewicz Posted August 20, 2007 Share Posted August 20, 2007 /* EDIT MODE */ case "edit": include "../includes/db_login.php"; $query = "SELECT * FROM tblName WHERE rowid = '$rowid'"; $result = mysql_query( $query ); if(!$result) { die("Could not query the database: <br/>" . mysql_error()); } while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = $row['rowid']; $company = $row['company']; $product = $row['product']; $description = $row['description']; $web = $row['web']; $last = $row['last']; $used = $row['used']; $active = $row['active']; echo ' <p class="casetext">Below is a more detailed description of <b>' . $product . '</b>.</p> <form action="hrdbcase.php?action=doedit" method="post" name="form1"> <p><input type="hidden" name="rowid" value="' . $id . '" /></p> <table border="0" align="center" cellpadding="4" style="margin-bottom: 5px;"> <tr> <td>Company:</td> <td><input type="text" name="company" value="' . $company . '" /></td> </tr> <tr> <td>Product:</td> <td><input type="text" name="company" value="' . $product . '" /></td> </tr> <tr> <td>Description:</td> <td><input type="text" name="company" value="' . $description . '" /></td> </tr> <tr> <td>Web Address:</td> <td><input type="text" name="company" value="' . $web . '" /></td> </tr> <tr> <td>Last Used:</td> <td><input type="text" name="company" value="' . $last . '" /></td> </tr> <tr> <td>When was <b>' . $product . '</b> last used:</td> <td><input type="text" name="company" value="' . $used . '" /></td> </tr> <tr> <td>Is <b>' . $product . '</b> Active or Inactive?:</td> <td><input type="text" name="company" value="' . $active . '" /></td> </tr> <tr> <td></td> <td><input type="submit" value="Submit" /></td> </tr> </table> </form> <p class="casetext" style="font-size: 125%;"><a href="hrdb.php">Go back to database?</a></p> '; } mysql_close($connection); include "../includes/footer.php"; exit; break; /* END EDIT MODE*/ /* EDIT ACTION HELD HERE */ case "doedit": include "../includes/db_login.php"; $query=" UPDATE tblName SET company = '" . $company . "', product = '" . $product . "', description = '" . $description . "', web = '" . $web . "', last = '" . $last . "', used = '" . $used . "', active = '" . $active . "' WHERE rowid = '" . $rowid . "' "; $result = mysql_query($query); if(!$result) { die("Could not query the database: <br/>" . mysql_error()); } while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<p class="casetext">Item updated</p>'; } mysql_close($connection); include "../includes/footer.php"; exit; break; /* END EDIT ACTION */ With the above code I am trying to get edit information pulling out of a database. Well When you get to the edit screen and then click submit to submit your changes all you get is a blank screen, well thats not entirely true (the header and the footer load). I have no idea why this is not working. Anyone have any ideas? All help is appreciated, Dennis Link to comment https://forums.phpfreaks.com/topic/65869-update-will-not-happen/ Share on other sites More sharing options...
jcanker Posted August 20, 2007 Share Posted August 20, 2007 Why are you processing an array as an else to if(!$result) for a mysql insert query? while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<p class="casetext">Item updated</p>'; } I'm still new around here, but I just do: if(!$result) { die("Could not query the database: " . mysql_error()); } else{echo '<p class="casetext">Item updated</p>'; } See you get output with that Link to comment https://forums.phpfreaks.com/topic/65869-update-will-not-happen/#findComment-329255 Share on other sites More sharing options...
dennismonsewicz Posted August 21, 2007 Author Share Posted August 21, 2007 You are right about the output, but the update does not happen. Any other ideas? Link to comment https://forums.phpfreaks.com/topic/65869-update-will-not-happen/#findComment-329913 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.