Jump to content

lauralee

Members
  • Content Count

    100
  • Joined

  • Last visited

Community Reputation

0 Neutral

About lauralee

  • Rank
    Member
  • Birthday 03/22/1952

Previous Fields

  • Languages
    html, css, some php

Contact Methods

  • Website URL
    http://lauralee-llc.com
  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    Raton, NM
  • Interests
    website design, gardening, sewing, quilting
  1. lauralee

    UPDATE not working

    Below is the code with the suggested changes. Still no UPDATE takes place. I use the same code to UPDATE another database table (with different field names) and it works. So I must be missing something here. if (isset($_POST['action']) and $_POST['action'] =='Edit'){ $fee_id = $_POST['fee_id']; $fee_title = $_POST['fee_title']; $fee_name = $_POST['fee_name'];$fee_description = $_POST['fee_description']; $fee_amount = $_POST['fee_amount']; $fee_order = $_POST['fee_order'];$fee_title= mysql_real_escape_string($fee_title);$fee_description= mysql_real_escape_string($fee_description); $fee_name= mysql_real_escape_string($fee_name);$fee_order= mysql_real_escape_string($fee_order);$sql = "UPDATE fee_schedule SET fee_id = '$fee_id', fee_title = '$fee_title', fee_name = '$fee_name', fee_description = '$fee_description', fee_amount = '$fee_amount', fee_order = '$fee_order' WHERE fee_id ='$fee_id'";ini_set('display_errors', 1);error_reporting(E_ALL); if (!mysql_query($sql)) { echo '<p>Error updating fee schedule: ' . mysql_error() . '</p>'; exit(); } }
  2. lauralee

    UPDATE not working

    I made the changes that you suggested with no result. I still receive no error, and no update takes place.
  3. lauralee

    UPDATE not working

    Thanks. But my problem is that the coding I use on one page works fine, but the other one doesn't, although they seem to be identical, just the names are different. Below is the update that works. Can you find a difference in the one I posted earlier that would explain why this one works and the other one doesn't? I can't find the problem in the UPDATE code that I posted earlier. if (isset($_POST['action']) and $_POST['action'] =='Edit'){ $contacts_id = $_POST['contacts_id']; $contacts_first_name = $_POST['contacts_first_name']; $contacts_last_name = $_POST['contacts_last_name'];$contacts_department = $_POST['contacts_department'];$contacts_title = $_POST['contacts_title']; $contacts_email = $_POST['contacts_email']; $contacts_order = $_POST['contacts_order']; $publish = $_POST['publish']; $contacts_first_name= mysql_real_escape_string($contacts_first_name); $contacts_last_name= mysql_real_escape_string($contacts_last_name); $contacts_email= mysql_real_escape_string($contacts_email); $sql = "UPDATE contacts SET contacts_first_name = '$contacts_first_name', contacts_last_name = '$contacts_last_name', contacts_department = '$contacts_department', contacts_title = '$contacts_title', contacts_email = '$contacts_email', contacts_order = '$contacts_order', publish = '$publish' WHERE contacts_id ='$contacts_id'"; if (!@mysql_query($sql)) { echo '<p>Error updating contacts: ' . mysql_error() . '</p>'; exit(); } }
  4. lauralee

    UPDATE not working

    Can anyone find the problem with my code? I have used this code to update a table of contact information in my database, but for some reason, this same structure doesn't work for updating a fee schedule table. I don't get any kind of error, it just won't update the table. echo '<form action=" " method="post">';echo '<table class="contactlist"><tr><caption>FEE SCHEDULE</caption></tr><tr><th>FOR:</th><th>TYPE<th>DESCRIPTION</th><th>AMOUNT</th><th>ORDER</th></tr>'; while ($rw = @mysql_fetch_array($rslt)) {echo '<input type="hidden" name="fee_id" value = "' . $rw['fee_id'] . '" />';echo '<tr><td><input type="text" name="fee_title" value = "' . $rw['fee_title'] . '" size="35" /></td>';echo '<td><input type="text" name="fee_name" rows="5" cols="20" value = "' . htmlspecialchars($rw['fee_name'], ENT_QUOTES, 'UTF-8') . '" size="30" /></td>';echo '<td><input type="text" name="fee_description" value = "' . htmlspecialchars($rw['fee_description'], ENT_QUOTES, 'UTF-8') . '" size="20" /></td>';echo '<td><input type="text" name="fee_amount" value="' . $rw['fee_amount'] . '" size="25" /></td>';echo '<td><input type="text" name="fee_order" value="' . $rw['fee_order'] . '" size="5" /></td>';echo '<td><input type="submit" name="action" value="Edit" /></td></tr>';echo '</form>';} echo '</table>'; if (isset($_POST['action']) and $_POST['action'] =='Edit'){ $fee_id = $_POST['fee_id']; $fee_title = $_POST['fee_title']; $fee_name = $_POST['fee_name'];$fee_description = $_POST['fee_description']; $fee_amount = $_POST['fee_amount']; $fee_order = $_POST['fee_order'];$fee_title= mysql_real_escape_string($fee_title);$fee_description= mysql_real_escape_string($fee_description); $fee_name= mysql_real_escape_string($fee_name);$fee_order= mysql_real_escape_string($fee_order);$sql = "UPDATE fee_schedule SET fee_id = '$fee_id', fee_title = '$fee_title', fee_name = '$fee_name', fee_description = '$fee_description', fee_amount = '$fee_amount', fee_order = '$fee_order' WHERE fee_id ='$fee_id'"; if (!@mysql_query($sql)) { echo '<p>Error updating fee schedule: ' . mysql_error() . '</p>'; exit(); } }
  5. But the form fields are populated with the text from the database table that are to be edited, they are not empty fields where text is to be entered, so I can't do an UPDATE until after the form is displayed with the populated fields can I?
  6. I added: echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; but it still doesn't show the changes until I refresh the page. I've also changed the form action to "http://www.conservfirst.com/admin/edit_family.php" but the changes still don't show up until I refresh the page. Any other suggestions?
  7. I have an administrator's page set up to update table contents in my database. It displays each field in a form using a table. Whenever I click on the submit button, I have to refresh the page to see the changes. But I want the changes to display immediately after clicking the submit button. I added header('Location: . ');exit(); to the code but I get the following error Warning: Cannot modify header information - headers already sent by (output started at /home/conservf/public_html/admin/edit_family.php:25) in /home/conservf/public_html/admin/edit_family.php on line 101 Below is the code - How can I fix this so when I edit the information in the table, it displays immediately? <body><div id="wrapper1"><a name="Top"></a><h1>Edit Family Names</h1><div class="textbox"><h4>Today is -<?php$my_t=getdate(date("U"));print("$my_t[weekday], $my_t[month] $my_t[mday], $my_t[year]<br />");?></h4><p><a href="<?php echo $_SERVER['PHP_SELF']; ?>?logout=1" >Logout</a></p><p><a href="http://www.conservfirst.com/admin/">Return to Admin Page</a></p><p><a href="edit_family.php">Refresh page</a></p><h4><a href="?addfamily">Add a new family</a></h4><?phpif (isset($_GET['addfamily'])){ include '/home/conservf/public_html/includes/addfamilyform.inc.html.php'; exit(); } ?></div><?php include '/home/conservf/public_html/includes/connection.inc.html.php'; ?><?php include '/home/conservf/public_html/includes/magicq.inc.html.php'; ?><?php include '/home/conservf/public_html/includes/helpers.inc.html.php'; ?><?php$sql = "SELECT * FROM family1 ORDER BY family_name"; $result = @mysql_query($sql); if (!result) { $error = 'Error fetching information'; exit();} echo '<table class="building"><tr><caption>Edit Family Names</caption</tr><tr><th>FAMILY</th><th>CATEGORY</th><th>DESCRIPTION</th><th>Item<br />order</th><th>In-<br />active</th></tr>'; while ($row = mysql_fetch_array($result)) { echo '<form action="http://www.conservfirst.com/admin/edit_family.php" method="post">';echo '<input type="hidden" name="familyid" value = "' . $row['familyid'] . '" />';echo '<td><input type="text" name="family_name" value = "' . htmlspecialchars($row['family_name'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>';echo '<td><input type="text" name="category" value = "' . htmlspecialchars($row['category'], ENT_QUOTES, 'UTF-8') . '" size="25" /></td>'; echo '<td><input type="text" name = "familydescription" value ="' . htmlspecialchars($row['familydescription'], ENT_QUOTES, 'UTF-8') . '" size="80" /></td>'; echo '<td><input type="text" name="item_order" value = "' . htmlspecialchars($row['item_order'], ENT_QUOTES, 'UTF-8') . '" size="2" /></td>'; echo '<td><input type="text" name="inactive" value = "' . htmlspecialchars($row['inactive'], ENT_QUOTES, 'UTF-8') . '" size="2" /></td>'; echo '<td><input type="submit" name="action" value="Edit" /></td></tr>'; if (isset($_POST['familyid'])) $familyid = $_POST['familyid']; $family_name = mysql_real_escape_string($_POST['family_name']); $category = mysql_real_escape_string($_POST['category']);$familydescription = mysql_real_escape_string($_POST['familydescription']); $inactive = $_POST['inactive']; $item_order = $_POST['item_order']; $sql = "UPDATE family1 SET family_name = '$family_name', category = '$category', familydescription = '$familydescription', inactive = '$inactive', item_order = '$item_order' WHERE familyid ='$familyid'"; if (!@mysql_query($sql)) { echo '<p>Error updating family1: ' . mysql_error() . '</p>'; exit(); } header('Location: . '); exit(); echo '</form>'; }echo '</table>';?></body>
  8. I am using a loop with a form to show products in a table that can be edited. When I click the "edit" button to post the update, I want the changes to show up immediately in the form. Right now, I have to refresh the page to see the changes. How can I get the changes to show immediately after clicking on the "edit" (submit) button? My form for editing product is shown below. echo '<a name="Building Envelope Products"></a>';$sql = "SELECT * FROM products WHERE category='Building Envelope Products' order by id"; $result = @mysql_query($sql); if (!result) { $error = 'Error fetching information';exit();} echo '<table class="building"><tr><caption>Edit Building Envelope Products</caption</tr><tr><th>ID</th><th>CATEGORY</th><th>FAMILY</th><th>FAMILY ID</th><th>SBFM</th><th>NAME</th><th>DESCRIPTION</th><th>COLOR</th><th>WT</th><th>PRICE</th><th>INACT</th><th>PayPal #</th><th>EDIT</th></tr>'; while ($row = mysql_fetch_array($result)) { echo '<form action=" " method="post">'; echo '<tr><td><input type="text" name="id" value = "' . $row['id'] . '" size="9" /></td>'; echo '<td><input type="text" name="category" value = "' . htmlspecialchars($row['category'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>'; echo '<td><input type="text" name="familyname" value = "' . htmlspecialchars($row['familyname'], ENT_QUOTES, 'UTF-8') . '" size="10" /></td>'; echo '<td><input type="text" name="family_id" value = "' . htmlspecialchars($row['family_id'], ENT_QUOTES, 'UTF-8') . '" size="10" /></td>'; echo '<td><input type="text" name="subfamily_identifier" value = "' . htmlspecialchars($row['subfamily_identifier'], ENT_QUOTES, 'UTF-8') . '" size="5" /></td>'; echo '<td><input type="text" name="name" value = "' . htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>'; echo '<td><input type="text" name="description" value = "' . htmlspecialchars($row['description'], ENT_QUOTES, 'UTF-8') . '" size="45" /></td>'; echo '<td><input type="text" name="color" value = "' . htmlspecialchars($row['color'], ENT_QUOTES, 'UTF-8') . '" size="5" /></td>'; echo '<td><input type="text" name="weight" value = "' . htmlspecialchars($row['weight'], ENT_QUOTES, 'UTF-8') . '" size="3" /></td>'; echo '<td><input type="text" name="list_price" value = "' . htmlspecialchars($row['list_price'], ENT_QUOTES, 'UTF-8') . '" size="3" /></td>'; echo '<td><input type="text" name="inactive" value = "' . htmlspecialchars($row['inactive'], ENT_QUOTES, 'UTF-8') . '" size="1" /></td>'; echo '<td><input type="text" name="button" value = "' . htmlspecialchars($row['button'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>'; echo '<td><input type="submit" name="action" value="Edit" /></td>'; if (isset($_POST['id']))$id = $_POST['id']; $familyname = $_POST['familyname']; $subfamily_identifier = $_POST['subfamily_identifier']; $name = $_POST['name']; $description = $_POST['description']; $color = $_POST['color']; $weight = $_POST['weight']; $list_price = $_POST['list_price']; $inactive = $_POST['inactive']; $button = $_POST['button']; $description = mysql_real_escape_string($description); $familyname = mysql_real_escape_string($familyname); $subfamily_identifier = mysql_real_escape_string($subfamily_identifier); $name = mysql_real_escape_string($name); $color = mysql_real_escape_string($color); $weight = mysql_real_escape_string($weight); $list_price = mysql_real_escape_string($list_price); $inactive = mysql_real_escape_string($inactive); $button = mysql_real_escape_string($button); $sql = "UPDATE products SET id = '$id', familyname = '$familyname', subfamily_identifier='$subfamily_identifier', name = '$name', description = '$description', color = '$color', weight = '$weight', list_price = '$list_price', inactive = '$inactive', button = '$button' WHERE id ='$id'"; if (!@mysql_query($sql)) { echo '<p>Error updating product: ' . mysql_error() . '</p>'; exit(); } echo '</form>';}echo '</table>';
  9. Currently in my code I select the current month and future months to be shown on the calendar. I want to be able to have only the current month and future months shown automatically using the date function. Below is my code. How do I change the WHERE mo_id>09 in the code so that I don't have to change it manually every month and the only the current month and future months will display, not all of the month's names? $sql = @mysql_query('SELECT mo_id, month_name FROM month WHERE mo_id>09 ORDER BY mo_id'); if (!$sql) {exit('<p>Error performing query: ' . mysql_error() . '</p>');}while ($mos = mysql_fetch_array($sql)) { echo '<h2>' . $mos['month_name'] . '</h2><br />'; $items = @mysql_query('SELECT *FROM calendar WHERE mo ="' . $mos['month_name'] . '" OR "' . $mos['dt'] . '" ORDER BY dt, am_pm, hr, min'); if (!$items) {exit('<p>Error performing query: ' . mysql_error() . '</p>');}while ($each = mysql_fetch_array($items)) {echo '<p><em>' . $each['mo'] . ' ' . $each['dt'] . ' </em>' . $each['hr'] . ':' . $each['min'] . ' ' . $each['am_pm'] . ' - <span>' . $each['location'] . ' - ' . $each['title'] . '</span> - ' . $each['event'] . '</p>';}}?>
  10. I have a membership table that includes a field for the date that a membership was added. I want to be able to automatically sort the table by those memberships that have expired after one year from the date the membership was added. Below is the code that lists the members followed by the date of the membership. while ($row = @mysql_fetch_array($result)){ echo '<div class="memberdetails"><span class="second">' . $row['member_name'] . '</span> - ' . $row['membership_date'] . '<br />'; } I'm not sure how to use the ADDDATE function. Please give me a sample of code that would provide an expiration date that is one year after the membership_date.
  11. lauralee

    Cpanel

    When you set up your website on a server you used a username and a password. Place them in your code where indicated below. $con = mysql_connect("localhost","username","password");
  12. Actually, the filename does have the .jpg extension. I just didn't type it in correctly in my previous response. So, I'm still stuck on this one.
  13. This may be too simple for what you are doing, but I have used the following code in a form to show the list of categories from the database category table in order to select one and insert it into a membership table in the database. Once the form is submitted, the information is inserted using INSERT INTO. $cat = @mysql_query('SELECT category_name, category_id FROM category ORDER BY category_name'); if (!$cat) { exit( '<p>Unable to obtain categories from the database.</p>'); }<h3>Select one category from drop-down list</h3><select name="category" size="1"> <option selected value="">Select Category</option><?php while ($row_ct = mysql_fetch_array($cat)) {$category_name = $row_ct['category_name']; echo "<option value='$category_name'>$category_name</option>\n"; } ?> </select><br />
  14. I found that the problem was actually in the css code. In the li li code I replaced padding:.2em; with 0 and the ghost effect disappeared.
  15. I have set up a drop down menu using only CSS that looks like a manilla file folder tab and works great in Mozilla Firefox, but in IE a partial tab to the left of the first tab appears thereby making the navigation bar look bad, and overruns the space allotted. I remember reading something about a ghost effect in IE that shows up sometimes, but I don't remember what the fix is. How can I get rid of that ghost li element in IE?Below is my navigation code:<ul id="nav"> <li><a href="http://www.raton.info.com/">Home</a></li> <li><a href="http://www.raton.info.com/about_us">About Us</a></li><li><div> <a href="http://www.raton.info.com/our_community/">Our Community</a></div> <ul class="none"> <li><a href="/art_culture">Arts & Culture</a></li> <li><a href="/business/">Business</a></li> <li><a href="/dining/">Dining</a></li> <li><a href="/education/">Education</a></li> <li><a href="/health/">Health Services</a></li> <li><a href="/real_estate/">Real Estate</a></li> <li><a href="/outdoor_recreation/">Outdoor Recreation</a></li> </ul> </li> <li> <div><a href="/area_attractions/">Area Attractions</a></div> <ul class="none"> <li><a href="/capulin/">Capulin Volcano National Monument</a></li> <li><a href="/nra_whittington/">NRA Whittington Center</a></li> <li><a href="/aquatic_center/">Raton Aquatic Center</a></li> <li><a href="/native_garden/">Santa Fe Trail Native Plant Garden</a></li> <li><a href="/sugarite/">Sugarite Canyon State Park</a></li> </ul> </li> <li><a href="/links/">Links</a></li></ul>
×
×
  • Create New...