Jump to content

dprichard

Members
  • Posts

    139
  • Joined

  • Last visited

    Never

Everything posted by dprichard

  1. I can't figure out what I am doing wrong here but any help would be greatly appreciated. I am trying to set a session variable along with my insert statement but on the next page when I do my query I get no results even though I know there are. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "add_folder")) { $doc_cat_id = $_POST['folder_doc_cat']; session_register("doc_cat_id"); $insertSQL = sprintf("INSERT INTO folders (folder_name, folder_creator, folder_status, folder_order, folder_description, folder_doc_cat) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['folder_name'], "text"), GetSQLValueString($_POST['folder_creator'], "int"), GetSQLValueString($_POST['folder_status'], "int"), GetSQLValueString($_POST['folder_order'], "int"), GetSQLValueString($_POST['folder_description'], "int"), GetSQLValueString($_POST['folder_doc_cat'], "int")); Then on my next page I have the query based off of the session variable, but I don't get anything back. $colname_folders = "-1"; if (isset($_POST['doc_cat_id'])) { $colname_folders = $_POST['doc_cat_id']; } $colname2_folders = "-1"; if (isset($_SESSION['doc_cat_id'])) { $colname2_folders = $_SESSION['doc_cat_id']; } mysql_select_db($database_ttracker, $ttracker); $query_folders = sprintf("SELECT * FROM folders_main WHERE folder_doc_cat = %s OR folder_doc_cat = %s ORDER BY folder_order ASC", GetSQLValueString($colname_folders, "int"),GetSQLValueString($colname2_folders, "text")); $folders = mysql_query($query_folders, $ttracker) or die(mysql_error()); $row_folders = mysql_fetch_assoc($folders); $totalRows_folders = mysql_num_rows($folders);
  2. Here is what I have come up with so far. I have these two forms that show the doc_cat_order and will subtract one if you click the up arrow and add one if you click the down arrow. I did the if / else to keep it from going negative or up eternally. I am not sure if this is something that should be in the php forum or mysql cause I don't know if it is something I will do in the programming or in the query. <form action="<?php echo $editFormAction; ?>" method="POST" name="up" id="up"> <input name="doc_cat_order" type="hidden" id="doc_cat_order" value="<?php $order_down = $row_doc_category['doc_cat_order']; if ($order_down == 1) { echo ($row_doc_category['doc_cat_order']);} else { echo ($row_doc_category['doc_cat_order'] - 1); } ?>"> <input name="doc_cat_id" type="hidden" id="doc_cat_id" value="<?php echo $row_doc_category['doc_cat_id']; ?>"> <input name="submit2" type="image" src="/images/arrow_up_blue.png" alt="Move Up" width="16" height="16"> <input type="hidden" name="MM_update" value="up"> </form> </td> <td class="icon_box"><form action="<?php echo $editFormAction; ?>" method="POST" name="down" id="down"> <input name="doc_cat_order" type="hidden" id="doc_cat_order" value="<?php $order_down = $row_doc_category['doc_cat_order']; $count = $row_cat_count['TOTAL']; if ($order_down == $count) { echo ($row_doc_category['doc_cat_order']);} else { echo ($row_doc_category['doc_cat_order'] + 1); } ?>"> <input name="doc_cat_id" type="hidden" id="doc_cat_id" value="<?php echo $row_doc_category['doc_cat_id']; ?>"> <input name="submit" type="image" src="/images/arrow_down_blue.png" alt="Move Down" width="16" height="16"> <input type="hidden" name="MM_update" value="down"> </form>
  3. I am working on a document section for my website and have a table that has something like this: doc_category_id doc_category_name doc_category_order I want the user to be able to reorder the items and make them appear in the order they want. Is it possible to list them category with the doc_category_id and doc_category_order of the record right before and right after the one they are viewing so that I can make a small form with up and down arrows that when submitted will change the current record order up or down one, but also change the previous record down one if they move the current item or or change the change the next record up one if they move the current item down?
  4. We had considered just having a number in there, but were running into problems if the employee just wanted a day off or a few hours off. So that is why we are trying to get down to the number of hours per day in case they want say two days off, but not every day off. The big issue I see is if they put in say January 1st 2008 to Jan 5th 2008 as the time they want off. How do I tell what days of the week they are asking for off?
  5. Okay, I want to bounce this off you experts cause I find I usually go about things the hard way so I want to see if this is the best way to do what I am trying to do. I am trying to track our employee's vacation requests and time off. The issue I have is not everyone works Monday through Friday and not everyone works the same number of hours per day. For instance, I may work 8 hour days monday through friday, but Bob may work Sunday Monday, have Tuesday off work Wednesday Thursday and Friday and have Saturday off. He works 7 hours every day except for Sunday which he works 3 hours on. When he puts in a time off request, I want to be able to calculate the number of hours he is requesting. What I am doing for the Monday through Friday employees is doing the date diff between the dates then adding 1 and multiplying it times the number of hours the employee is working each day to get the total number of hours they are requesting off. I am using a table with all the weekend and holidays in it and get a count of days that fall within the request days that are either weekend or holidays and subtract those out. I want it to be more flexible going forward and want it to allow me to work in a schedule like Bob's schedule. Here is what I was thinking might work: Have a table that shows date, date type like this date_id date date_type 1 2008-01-01 1 2 2008-01-02 2 1 2008-01-03 3 The have a table that shows date type 1 as a Sunday date type 2 as a monday, date type 3 as a tuesday, etc. Then for the employee have date_type_1, date_type_2, date_type_3, etc and have date_type_1_hours, date_type_2_hours, date_type_3_hours, etc. Then I could say exclude days that they don't have matching date types for and then calculate the times based on the date_type_1 hours. Does this sound like it will work? Any thoughts on an easier way to do this? Thanks for any help you can give on this. ;D
  6. Thank you so much! I thought it had something to do with the quotes, but wasn't sure how to get rid of them.
  7. I tried it like this... INSERT INTO emp_time_table (empto_emp_id, empto_to_type_id, empto_accrual_start_date, empto_accrual_expiration_date, empto_plan_cap, empto_max_carry_over, empto_waiting_period, empto_renewal_term, empto_time_accrued, empto_last_updated, empto_updated_by) VALUES (%s, %s, %s, %s, %s, %s, ADDDATE(CURRENT_DATE, INTERVAL %s %s), %s, %s, %s, %s)", GetSQLValueString($_POST['empto_emp_id'], "int"), GetSQLValueString($_POST['empto_to_type_id'], "int"), GetSQLValueString($_POST['empto_accrual_start_date'], "date"), GetSQLValueString($_POST['empto_accrual_expiration_date'], "date"), GetSQLValueString($_POST['empto_plan_cap'], "text"), GetSQLValueString($_POST['empto_max_carry_over'], "text"), GetSQLValueString($_POST['interval'], "int"), GetSQLValueString($_POST['period'], "text"), GetSQLValueString($_POST['empto_renewal_term'], "int"), GetSQLValueString($_POST['empto_time_accrued'], "double"), GetSQLValueString($_POST['empto_last_updated'], "date"), GetSQLValueString($_POST['empto_updated_by'], "int")); But and still getting an error... You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''DAY'), 12, '0', '2007-05-30', 71)' at line 1 I checked the syntax versus what is on MySQL's site, and it looks fine. Any other help would be appreciated! ???
  8. I have a form that lets a user choose whether or not they have to wait days or months and lets them specify the number of days or months they have to wait. They choose the radio button wait_days_months and then they put in the number of days or months they have to wait in wait_number. Once they do, I am trying to add that date to today's date and then save it as the result in the field in the database. I think I am close, but can't get this one down. Any help would be greatly appreciated!!! INSERT INTO emp_time_table (empto_emp_id, empto_to_type_id, empto_accrual_start_date, empto_accrual_expiration_date, empto_plan_cap, empto_max_carry_over, empto_waiting_period, empto_renewal_term, empto_time_accrued, empto_last_updated, empto_updated_by) VALUES (%s, %s, %s, %s, %s, %s, CASE WHEN %s = 'months' THEN DATE_ADD(%s + INTERVAL %s MONTH) WHEN %s = 'days' THEN DATE_ADD(%s, INTERVAL %s DAY) END, %s, %s, %s, %s)", GetSQLValueString($_POST['empto_emp_id'], "int"), GetSQLValueString($_POST['empto_to_type_id'], "int"), GetSQLValueString($_POST['empto_accrual_start_date'], "date"), GetSQLValueString($_POST['empto_accrual_expiration_date'], "date"), GetSQLValueString($_POST['empto_plan_cap'], "text"), GetSQLValueString($_POST['empto_max_carry_over'], "text"), GetSQLValueString($_POST['wait_days_months'], "text"), GetSQLValueString($_POST['today'], "date"), GetSQLValueString($_POST['wait_number'], "int"), GetSQLValueString($_POST['wait_days_months'], "text"), GetSQLValueString($_POST['today'], "date"), GetSQLValueString($_POST['wait_number'], "int"), GetSQLValueString($_POST['empto_renewal_term'], "int"), GetSQLValueString($_POST['empto_time_accrued'], "double"), GetSQLValueString($_POST['empto_last_updated'], "date"), GetSQLValueString($_POST['empto_updated_by'], "int"));
  9. I have been searching trying to figure out if this is possible. I need to figure out how many days are between certain dates excluding weekends. Is it possible to do this. I have tried searching google, but I guess I am not using the right keywords because the results I am getting back aren't giving me much help. I was thinking about setting up a table and putting in all weekend dates and then pulling in that data, but thought there might be an easier way. ??? ??? ???
  10. I am not sure what I am doing wrong here, but I am trying to make a form that changes based on the status of a gallery in my script. Here is the If statement, but I am getting the followin error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\sitename\admin\admin-gallery-add-1.php on line 161 Any help would be greatly appreciated. Thank you! [code] <?php                          if ($row_galleries['gallery_status'] == 0) { echo "<input name="gallery_status" type="hidden" id="gallery_status" value="1"> <input name="gallery_id" type="hidden" id="gallery_id" value="$row_galleries['gallery_id']"> <input type="image" name="submit2" src="../images/icons/forbidden.png" width="16" height="16">";                        } if ($row_galleries['gallery_status'] == 1) {                        echo '<input name="gallery_status" type="hidden" id="gallery_status" value="0"> <input name="gallery_id" type="hidden" id="gallery_id" value="echo $row_galleries['gallery_id']"> <input type="image" name="submit2" src="../images/icons/add.png" width="16" height="16">'; }                        ?> [/code]
×
×
  • 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.