Jump to content

Greaser9780

Members
  • Posts

    326
  • Joined

  • Last visited

    Never

Everything posted by Greaser9780

  1. How do I correct for the 16 hour difference? $t-$n-57600
  2. <? include("db.php"); $blah=mysql_query("SELECT time,exptime FROM time "); $rst=mysql_fetch_array($blah); $n= time(); $t = strtotime($rst['exptime']); $disp=$t - $n; echo date("G:i:s",$disp) ; ?> That is my code to display how much time is left. If I echo the time now it is correct. If I echo $t it matches the db. Can anyone tell me why $t-$n is always positive 16 extra hours over what it should be?
  3. OK I got the function and the code to work. Kind of. The user clicks on a radio button(position) to select which will inturn show the dropdown box with all the listed players at that position. The problem now is it works great for display but since all the other dropdowns are merely 'hidden' they still have values. When sending the form it always defaults to the last dropbox no matter which radio button is clicked on. Here is my code: <html><head><title>The Form</title> <script type="text/javascript"> function toggleField(field,vis) { if (vis) { document.getElementById(field).style.visibility = 'visible'; } else { document.getElementById(field).style.visibility = 'hidden'; } } </script> </head> <body> <form action="select.php" method="post"> <input type="radio" name="show" value="showone" onclick="toggleField('showone',true);toggleField('showtwo',false);toggleField('showthree',false) ;toggleField('showfour',false);toggleField('showfive',false);toggleField('showsix',false)" />QB<br /> <input type="radio" name="show" value="showtwo" onclick="toggleField('showone',false);toggleField('showtwo',true);toggleField('showthree',false) ;toggleField('showfour',false);toggleField('showfive',false);toggleField('showsix',false)" />WR<br /> <input type="radio" name="show" value="showthree" onclick="toggleField('showone',false);toggleField('showtwo',false);toggleField('showthree',true) ;toggleField('showfour',false);toggleField('showfive',false);toggleField('showsix',false) " />RB<br /> <input type="radio" name="show" value="showfour" onclick="toggleField('showone',false);toggleField('showtwo',false);toggleField('showthree',false);toggleField('showfour',true) ;toggleField('showfive',false);toggleField('showsix',false) " />TE<br /> <input type="radio" name="show" value="showfive" onclick="toggleField('showone',false);toggleField('showtwo',false);toggleField('showthree',false);toggleField('showfour',false);toggleField('showfive',true);toggleField('showsix',false)" />PK<br /> <input type="radio" name="show" value="showsix" onclick="toggleField('showone',false);toggleField('showtwo',false);toggleField('showthree',false);toggleField('showfour',false);toggleField('showfive',false);toggleField('showsix',true)" />DF<br /> <input type="radio" name="show" value="noshow" checked="checked" onclick="toggleField('showone',false);toggleField('showtwo',false);toggleField('showthree',false);toggleField('showfour',false);toggleField('showfive',false) ;toggleField('showsix',false) " />No Show <div name="showone" id="showone" style="visibility:hidden"> <select name='playername'> <?php include("db.php"); $sql4=mysql_query("SELECT * FROM players WHERE position='QB' and taken='0' ORDER BY name ASC") or die(mysql_error()); $res=mysql_fetch_array($sql4); $rst=$res['name']; $lab=$res['position']; while ($res = mysql_fetch_array($sql4, MYSQL_ASSOC)){ echo "<option value='" . $res['name'] . "'>" . $res['name'] . "</option>"; } ?> </select> </div> <div name="showtwo" id="showtwo" style="visibility:hidden"> <select name='playername'> <?php include("db.php"); $sql4=mysql_query("SELECT * FROM players WHERE position='WR' and taken='0' ORDER BY name ASC") or die(mysql_error()); $res=mysql_fetch_array($sql4); $rst=$res['name']; $lab=$res['position']; while ($res = mysql_fetch_array($sql4, MYSQL_ASSOC)){ echo "<option value='" . $res['name'] . "'>" . $res['name'] . "</option>"; } ?> </select> </div> <div name="showthree" id="showthree" style="visibility:hidden"> <select name='playername'> <?php include("db.php"); $sql4=mysql_query("SELECT * FROM players WHERE position='RB' and taken='0' ORDER BY name ASC") or die(mysql_error()); $res=mysql_fetch_array($sql4); $rst=$res['name']; $lab=$res['position']; while ($res = mysql_fetch_array($sql4, MYSQL_ASSOC)){ echo "<option value='" . $res['name'] . "'>" . $res['name'] . "</option>"; } ?> </select> </div> <div name="showfour" id="showfour" style="visibility:hidden"> <select name='playername'> <?php include("db.php"); $sql4=mysql_query("SELECT * FROM players WHERE position='TE' and taken='0' ORDER BY name ASC") or die(mysql_error()); $res=mysql_fetch_array($sql4); $rst=$res['name']; $lab=$res['position']; while ($res = mysql_fetch_array($sql4, MYSQL_ASSOC)){ echo "<option value='" . $res['name'] . "'>" . $res['name'] . "</option>"; } ?> </select> </div> <div name="showfive" id="showfive" style="visibility:hidden"> <select name='playername'> <?php include("db.php"); $sql4=mysql_query("SELECT * FROM players WHERE position='K' and taken='0' ORDER BY name ASC") or die(mysql_error()); $res=mysql_fetch_array($sql4); $rst=$res['name']; $lab=$res['position']; while ($res = mysql_fetch_array($sql4, MYSQL_ASSOC)){ echo "<option value='" . $res['name'] . "'>" . $res['name'] . "</option>"; } ?> </select> </div> <div name="showsix" id="showsix" style="visibility:hidden"> <select name='playername'> <?php include("db.php"); $sql4=mysql_query("SELECT * FROM players WHERE position='DF' and taken='0' ORDER BY name ASC") or die(mysql_error()); $res=mysql_fetch_array($sql4); $rst=$res['name']; $lab=$res['position']; while ($res = mysql_fetch_array($sql4, MYSQL_ASSOC)){ echo "<option value='" . $res['name'] . "'>" . $res['name'] . "</option>"; } ?> </select> </div> </form> </body> </html>
  4. U da man. I forgot to take out the var d part. After that it worked like a charm.
  5. I figured out how to get the error. Here it is: findDOM is not defined
  6. In firefox it doesn't show an error but the dropdowns never appear like it's not working
  7. Just for fun, where you have localhost try mysql. For my connection that's what I needed.
  8. It still puts the little alarm thing up and says error on page in the bottom left corner of my browser. Am I not including the function right?
  9. No clue man sorry. Way more than I needed there. It just confused me. I just can't figure out why I can't get this simple thing to work. I will post the page: <html><head><title>The Form</title> <script type="text/javascript"> function toggleField(field,vis) { var d = findDOM(field,1); if (vis) { d.visibility = 'visible'; } else { d.visibility = 'hidden'; } } </script> </head> <body> <form action="select.php" method="post"> <input type="radio" name="show" value="show1" onclick="toggleField('showone',true);toggleField('showtwo',false)" />Show 1<br /> <input type="radio" name="show" value="show2" onclick="toggleField('showone',false);toggleField('showtwo',true)" />Show 2<br /> <input type="radio" name="show" value="noshow" checked="checked" onclick="toggleField('showone',false);toggleField('showtwo',false)" />No Show </form> <div name="showone" id="showone" style="visibility:hidden"><table align="center" width="100" border="1"><tr><td align="center">Show 1</td></tr></table></div> <div name="showtwo" id="showtwo" style="visibility:hidden"><table align="center" width="100" border="5"><tr><td align="center">Show 2</td></tr></table></div> </body> </html>
  10. Here is the function: function toggleField(field,vis) { var d = findDOM(field,1); if (vis) { d.visibility = 'visible'; } else { d.visibility = 'hidden'; } } Here is that section of the form: <input type="radio" name="show" value="show1" onclick="toggleField('showone',true);toggleField('showtwo',false)" />Show 1<br /> <input type="radio" name="show" value="show2" onclick="toggleField('showone',false);toggleField('showtwo',true)" />Show 2<br /> <input type="radio" name="show" value="noshow" checked="checked" onclick="toggleField('showone',false);toggleField('showtwo',false)" />No Show <div name="showone" id="showone" style="visibility:hidden"><table align="center" width="100" border="1"><tr><td align="center">Show 1</td></tr></table></div> <div name="showtwo" id="showtwo" style="visibility:hidden"><table align="center" width="100" border="5"><tr><td align="center">Show 2</td></tr></table></div>
  11. I want to use java to hide dropdown boxes untill a radio button is chosen. Then depending on which radio button is selected it shows the appropriate query in a dropdown. I don't use alot of java. I placed the function in the head of my document. And used onclick for the radio buttons to display the next dropdown. Everytime I click on one of the buttons at the bottom of my browser it shows an error is on the page. Any clues?
  12. I want to use java to hide dropdown boxes untill a radio button is chosen. Then depending on which radio button is selected it shows the appropriate query in a dropdown. I don't use alot of java. I placed the function in the head of my document. And used onclick for the radio buttons to display the next dropdown. Everytime I click on one of the buttons at the bottom of my browser it shows an error is on the page. Any clues?
  13. I just don't understand. I want it all on the same page I want to select a group from six. Then depending on which group is chosen it shows the dropdown fo r the appropriate query.
  14. I want a dropdown box that will choose which results to show in a second dropdown. I was gonna use Javascript for this but can't figure out how to make the second box show results from a query as it would have to be php inside of a java function. Any clues
  15. I think I get it. Because I called it outside the while loop already that's why it left one out.
  16. The following is some of my code for a dropdown box from a query. I tried ORDERing the info many ways. There are 12 names in the table but it always shows 11. What am I missing? <select name='1name'> <?php $sql1=mysql_query("SELECT * FROM draft_teams WHERE teamid > '0' ORDER BY name DESC") or die(mysql_error()); $res1=mysql_fetch_array($sql1); $rst1=$res1['name']; while ($res1 = mysql_fetch_array($sql1, MYSQL_ASSOC)){ echo "<option value='" . $res1['name'] . "'>" . $res1['name'] . "</option>"; } ?> </select><br>
  17. Anyone know what's wrong with this: $name_sql = mysql_query("SELECT name FROM `draft_teams` WHERE `name` ='$name'"); $pass_sql = mysql_query("SELECT pass FROM `draft_teams` WHERE `pass` ='$pass'"); $name_match=mysql_result($name_sql, 0, 'name_match'); $pass_match= mysql_result($pass_sql, 0, 'pass_match'); Here's the error: Warning: mysql_result() [function.mysql-result]: name_match not found in MySQL result index 3 in select.php on line 31
  18. So when I enter the field for expiry time it should be exptime=strtotime() + INTERVAL 5 MINUTE IS that correct?
  19. At this point I don't even know what type to set my field to in my table. I have a table where I keep a value"expirytime". I have tried TIME,DATETIME,TIMESTAMP and get nothing but an undesireable result. Here is my code for the script that displays time remaining in minutes and seconds: <?php include("db.php"); $blah=mysql_query("SELECT exptime FROM time "); $rst=mysql_fetch_array($blah); $n= time(); $t=$rst["exptime"]; $disp=$t - $n; echo $t ; echo"<br>"; echo $n; echo"<br>"; $minutes = floor($disp /3600); echo date("i:s",$minutes) ; include("login.php"); ?> I think the main problem is I can't seem to get $n and $t to be displayed in the same format. I banged my head against the wall for hours last night. Any help is greatly appreciated.
  20. So when it says comand to run enter: crontab filename crontimer.php
×
×
  • 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.