Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. try putting Chocolate and Sugar Free in single quotes
  2. <?php include "../includes/header.php"; $action = $_GET['action']; $rowid = $_GET['id']; switch($action) { /* MORE DETAILED VIEW */ case "view": 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)) { $rowid = $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> <table border="0" align="center" cellpadding="4" style="margin-bottom: 5px;"> <tr> <td>Company:</td> <td>' . $company . '</td> </tr> <tr> <td>Product:</td> <td>' . $product . '</td> </tr> <tr> <td>Description:</td> <td>' . $description . '</td> </tr> <tr> <td>Web Address:</td> <td><a href="' . $web . '" target= "_blank">' . $web . '</a></td> </tr> <tr> <td>Last Used:</td> <td>' . $last . '</td> </tr> <tr> <td>When was <b>' . $product . '</b> last used:</td> <td>' . $used . '</td> </tr> <tr> <td>Is <b>' . $product . '</b> Active or Inactive?:</td> <td>' . $active . '</td> </tr> </table> <p class="casetext" style="font-size: 125%;"><a href="hrdb.php">Go back to database?</a></p> '; } mysql_close($connection); include_once "../includes/footer.php"; exit; break; /* END DETAILED VIEW */ /* 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="product" value="' . $product . '" /></td> </tr> <tr> <td>Description:</td> <td><input type="text" name="description" value="' . $description . '" /></td> </tr> <tr> <td>Web Address:</td> <td><input type="text" name="web" value="' . $web . '" /></td> </tr> <tr> <td>Last Used:</td> <td><input type="text" name="last" value="' . $last . '" /></td> </tr> <tr> <td>When was <b>' . $product . '</b> last used:</td> <td><input type="text" name="used" value="' . $used . '" /></td> </tr> <tr> <td>Is <b>' . $product . '</b> Active or Inactive?:</td> <td><input type="text" name="active" 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()); } else { echo '<p class="casetext">Item Updated</p>'; } mysql_close($connection); include "../includes/footer.php"; exit; break; /* END EDIT ACTION */ case "delete": $id = $_GET['id']; echo '<p class="casetext">Are you sure you want to <strong>delete</strong> this item?<br/>'; echo 'This is a final action. If you make a mistake, this cannot be undone.<br/>'; echo '<a href="hrdbcase.php?action=dodelete&id=' . $id . '"><big>Yes, Delete This</big></a> | <a href="hrdb.php"><big>No, Go Back</big></a> '; echo '</p>'; include_once "../includes/footer.php"; exit; break; case "dodelete": include "../includes/db_login.php"; $query="DELETE FROM hrlanding WHERE rowid='" . $id . "'"; $result = mysql_query($query); if(!$result) { die("Could not query the database: <br/>" . mysql_error()); } else { echo '<p class="casetext">Item has been permanetly deleted<br/>'; echo 'To return to the database, <a href="hrdb.php">Click Here</a></p>'; } include_once "../includes/footer.php"; exit; break; } include "../includes/footer.php"; ?> The following code above is being used to edit/updated/delete an item in a database. Well I can view the information perfectly, but when I try to edit the information, I get a successful message but the edits do not go through. And when you try to delete an item the delete command does not delete the item. I need help URGENTLY! Thanks for any suggestions in advance. -Dennis
  3. You are right about the output, but the update does not happen. Any other ideas?
  4. /* 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
  5. It is a contact form. I work for an university and the results are being sent from the website to a database which are displaying correctly in the CMS but the form is not emailing the results
  6. Is there anyway, while using the mail function in PHP, to write some code to connect to a SMTP server? I have a form for my website but it is not sending me the results when it is filled out and the only conclusion i have is that the site cannot connect because of authentication problem.
  7. is there anyone who could help me do this?
  8. I am looking for a way to be able to hide some text that is being pulled from a database. For example If I have the following text being pulled out of a database onto my website, I want a way to be able to hide like the third paragraph on and replace that with a morre button than when a user clicks the more button it reveals the rest of the text: Can anyone help? Thanks, -Dennis
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.