Jump to content

dmhall0

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything posted by dmhall0

  1. Nevermind... I figured it out. Stupid mistake on my part. I set the image as a link and had href="" so it was reloading the page, thus show then hide again when the page would reload.
  2. I am using the jQuery toggle function to display a menu when the user clicks on an image. The menu starts off hidden but when I click on the image it appears correctly, lasts less than 1 second, and then hides again. Here is my js/jquery code: <script type="text/javascript" src="'.base_url().'assets/jquery/js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="'.base_url().'assets/jquery/js/jquery-ui-1.8.21.custom.min.js"></script> <script type="text/javascript"> $("document").ready(function() { $("#user_menu").hide(); $("a.menu_title").click(function() { $("#user_menu").toggle(); }); });</script> Any ideas why this is happening? Thanks!
  3. I changed the value to minutes and added an ID to the dropdown; but am still getting the same error message saying value is null for the first field.
  4. I have 3 input dropdown fields that show certain units of time. I have another field (read-only) that I want to dynamically show the sum of those fields. When the page is loaded I pull the saved times from the database. At this point I want to auto-calculate the total time; and then if the user changes the values I want the total time to update. Here is my html of the dropdown fields, which is selected, and the field I want the total to show in. <tr class="train_day1"> <td>Monday</td> <td> <select name="mon_1_time"> <option value="01:30:00">01:30:00</option> <option value="02:00:00">02:00:00</option> <option selected="selected" value="02:30:00">02:30:00</option> <option value="03:00:00">03:00:00</option> <option value="03:30:00">03:30:00</option> </select> </td> <td> <select name="mon_2_time"> <option value="01:30:00">01:30:00</option> <option selected="selected" value="02:00:00">02:00:00</option> <option value="02:30:00">02:30:00</option> <option value="03:00:00">03:00:00</option> <option value="03:30:00">03:30:00</option> </select> </td> <td> <select name="mon_3_time"> <option value="01:30:00">01:30:00</option> <option value="02:00:00">02:00:00</option> <option value="02:30:00">02:30:00</option> <option value="03:00:00">03:00:00</option> <option selected="selected" value="03:30:00">03:30:00</option> </select> </td> <td> <input id="mon_total" type="text" size="10" value="" name="mon_total"> </td> </tr> Here is my javascript function: function training_times() { //set the variables var mon_1_time = document.getElementById('mon_1_time'); var mon_2_time = document.getElementById('mon_2_time'); var mon_3_time = document.getElementById('mon_3_time'); var mon_total = document.getElementById('mon_total'); //calculate the results mon_total.value = (mon_1_time.options[mon_1_time.selectedIndex].value + mon_2_time.options[mon_2_time.selectedIndex].value + mon_3_time.options[mon_3_time.selectedIndex].value); } Here I call the function on page load: <script type="text/javascript"> window.onload = training_times()</script> I get the following error when I run the page: "mon_1_time is null" What am I doing wrong? How do I properly format the time to add it and display again as hh:mm:ss? Thanks!
  5. WOW... had to be something that simple! Thanks! See any other issues with the way I am doing it?
  6. I am trying to take 2 input fields, multiply them, and return the result in another input field. Here is my javascript function which is located in the <head> section of my code. <script language="javascript" type="text/javascript"> function hrzones() { var a = document.getElementById('fthr'); var b = document.getElementById('mhr'); var c = document.getElementById('hr1_min'); c.value = parseInt(a.value) + parseInt(b.value); } </script> So basically I am wanting to take fthr * mhr and return to the page hr1_min. Here is what my html looks like where I call the function. <input class="next" type="button" onclick="hrzones();" value="Calculate Heart Rate Zones" name="hrzones"> When I click on the button nothing happens; and Firebug give me the error message, "hrzones is not a function" What is going on?! Sorry if this is simple, I am really new to Javascript as you can tell by the amazing complexity of this function! haha
  7. When a user logs into my site I was to store the user_name, user_role, and user_id in a session variable, then store this in a regular variable to make querying easier, but I am having issues with my code as its causing issues with my queries. if (mysqli_num_rows($data) > 0) { //set sessions $row = mysqli_fetch_array($data); $_SESSION['username'] = $row['username']; $_SESSION['user_role'] = $row['role']; $_SESSION['user_id'] = $row['user_id']; //set variables $username = $_SESSION['username']; $user_role = $_SESSION['user_role']; $user_id = $_SESSION['user_id']; } Any ideas whats wrong?! Thanks for the help!!
  8. Ok I found out how to see that. Here is the last day's entries. I would say this date is probably right around when I know it worked last. [Thu Apr 19 18:34:07 2012] [warn] pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [Thu Apr 19 18:34:07 2012] [notice] Digest: generating secret for digest authentication ... [Thu Apr 19 18:34:07 2012] [notice] Digest: done [Thu Apr 19 18:34:09 2012] [notice] Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations [Thu Apr 19 18:34:09 2012] [notice] Server built: Oct 18 2010 01:58:12 [Thu Apr 19 18:34:09 2012] [notice] Parent: Created child process 3500 Terminating on signal SIGTERM(15) ] Digest: generating secret for digest authentication ... [Thu Apr 19 18:34:10 2012] [notice] Digest: done [Thu Apr 19 18:34:10 2012] [notice] Child 3500: Child process is running [Thu Apr 19 18:34:10 2012] [notice] Child 3500: Acquired the start mutex. [Thu Apr 19 18:34:10 2012] [notice] Child 3500: Starting 150 worker threads. [Thu Apr 19 18:34:10 2012] [notice] Child 3500: Starting thread to listen on port 443. [Thu Apr 19 18:34:10 2012] [notice] Child 3500: Starting thread to listen on port 80. Terminating on signal SIGTERM(15)
  9. Sorry for my ignorance... how do I check that?!
  10. Not sure if this is the right place for this but... I was building my site on localhost and its been working for the longest time. I got to work on it the other day and now I get the "Error 404 The requested resource is not found" I am using XAMPP and it appears Apache won't start up. Any ideas why this stopped working and how to fix? Thanks everyone!
  11. Thanks guys. I used ... WHERE DATE(ship_date) <= '$first_date' ... and that worked. Thanks again for the help!
  12. I need to pull data from a MySQL table that has a datetime field. The user selects 2 dates, a start and stop, and I need to filter the data by everything between and including those dates. The LIKE doesn't seem to work with a comparison operator. Here is what I have. $start_date = '2012-01-01'; $end_date = '2012-02-28'; $query = "SELECT ship_date, sku, shipqty, fgt_cost FROM shipments WHERE ship_date >= LIKE '$start_date%' AND ship_date <= LIKE '$end_date%'"; How can I make this work? Thanks!!
  13. I have a MySQL query that pulls multiple columns with many rows. I want to break each column into its own array. Here is what I have to this point but doesn't seem to be working. Is this the right direction or is there something easier? Thanks! $query = "SELECT name, address, city, state FROM customers WHERE sku = '12345'"; $result = mysqli_query($dbc, $query) or die(); $name = array(); $address = array(); $city = array(); state = array(); while ($data = mysqli_fetch_assoc($result)) { $name = $data['name']; $address = $data['address']; $city = $data['city']; $state = $data['state']; }
  14. Hey Guys thanks for all the help. I figured it out by creating a function to change my time to seconds, then they added just fine. Plus figured the function could be useful in the future. Here's the result... //time to seconds of the format hh:mm:ss function time_to_sec($time) { $t = explode(':', $time); $in_sec = $t[0] * 3600 + $t[1] * 60 + $t[3]; return $in_sec; } $time_finish = date('Y-m-d H:i:s', (strtotime($time_start) + time_to_sec($duration)));
  15. There are 2 fields in a form. One to capture start time and the other to capture duration. So here is what I have. $time_start = '2012-20-24 03:30:00'; $duration = '02:00:00'; $time_finish = date('Y-m-d H:i:s', (strtotime($time_start) + strtotime($duration,0))); echo $time_finish; This gives me 2012-02-23 10:30:00. Goes back in time?
  16. Probably something simple but I have searched high and low and can't figure this one out. I have a variable that is of the datetime format. I have another variable that is of the time format. I need to add them together. Example: $var1 = 2012-02-24 06:38:22 $var2 = 02:00:00 $var3 = $var1 + $var2 = 2012-02-24 08:38:22 Thanks for the help!
  17. Found a way to solve it via MySQL here. http://www.freeopenbook.com/mysqlcookbook/mysqlckbk-CHP-12-SECT-13.html Thanks for the help though.
  18. I am wanting to find the difference between every 2 points, just like in my first post example, then sum all the numbers > 0, sum all the numbers < 0, then give me the total. So if there are 1000 points in the array, I would get 500 numbers.
  19. SELECT elevation FROM track_points WHERE activity_id = '813'; There could be thousands of points (rows) for the one activity, so doing the work in the query is pretty much out of the question.
  20. I have elevation points in an array. I need to calculate the difference between each point to get the total gain, total loss, and net. Example: point 2 - point 1 = +100 point 3 - point 2 = -10 point 4 - point 3 = -20 ... and so on So my outputs need to be: Total Gain = +100 Total Loss = -30 Total Net = +70 Any help would be great. I am still new to coding but this seems complicated.
  21. Yes, that is it. And the only session variable I have is for the username.
  22. That didn't work. It gave me this error message: Fatal error: Can't use function return value in write context I tried putting session_destroy() last and it works on Chrome, but still not logging out on Firefox, Opera, or IE. Makes no sense.
  23. For some reason my logout is not working properly. I searched other forum posts and read some tutorials but I still have an issue. Do this to create session: $_SESSION['username'] = $row['username']; setcookie('username', $row['username'], time() + (60 * 60 * 24 * 5)); Do this to log out the user session_start(); session_unset(); $_SESSION = array(); setcookie(session_name(), '', time() - 3600); session_destroy(); setcookie('username', '', time() - 3600); Above all else I am trying to end the $_SESSION['username'] Thank you all
×
×
  • 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.