Jump to content

joecooper

Members
  • Posts

    358
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

joecooper's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. $newtime = date("Y-m-d H:i:s", time() + 600); mysql_query("UPDATE rounds SET clock = $newtime WHERE `round`='$CurrentRound' ") or die(mysql_error()); //update DB This code is failing to add the current time (+10 mins) to the MySQL database. The cell in the database is datetime format. I had done this before, but upon rewriting the code, it has stopped working.
  2. Sorry, here is the link http://82.145.36.70/ So other than that the script is fine? Is there not a way to have a refreshing function that gets a single value for the date from another page? Rather than reload the clock script each time?
  3. I guess its not a big deal if they wanted to have a look.
  4. It is a countdown that eventually would get the new date to count down to from a MySQL query. But it can change often and needs to refresh every second. Live example: http://www.mp3joe.com Not sure why it keeps disapearing like it is. index.php: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <head> <script type="text/javascript">// <![CDATA[ $(document).ready(function() { $.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh setInterval(function() { $('#results').load('data.php'); }, 5000); // the "3000" here refers to the time to refresh the div. it is in milliseconds. }); // ]]></script> </head> <div id="results">Loading users...</div> data.php: <head> <link rel="stylesheet" href="jquery.countdown.css"> <style type="text/css"> #defaultCountdown { width: 240px; height: 45px; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.countdown.js"></script> <script type="text/javascript"> $(function () { var austDay = new Date(); austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26); $('#defaultCountdown').countdown({until: austDay}); $('#year').text(austDay.getFullYear()); }); </script> </head> <div id="defaultCountdown"></div>
  5. Hi, I am very new to JQuery, but supprised how easy it really is. I have a simple refresh script. Every second, data.php is called and populates a div tag. How do i stop people accessing data.php directly? So only in the JS. Thanks
  6. Ok Solved! Thanks a lot! will be back here later asking how to AJAX this script! haha.
  7. Thank you for your reply. I have changed a lot of code to only add the entries that have boats, chests, boxs, have been clicked. Empty boxes don't have an entry on the DB. I will work on AJAX to make it update only where needed, but thats a new thing for me, need to look in to it more, but was an ultimate goal. Yes I have a script to get load times, currently around a second to generate. The problem I am having at the moment is the code that generates the grid isn't displaying correctly. It displays with the grid always empty (as in, clickable) and when you click on one that has already been clicked, it will give the error message. So the code that processes the clicks is working fine, just the displaying. At the moment I have got a query to the database to get all the rows in the database. Then as it generates the grid, it checks if the current generating cell has a database entry. If it has an entry and that box has been clicked, it will display the clicked image. Although this isn't working. <?php //This file generates the grid for the users if (!isset($including)) die("direct access not permitted"); $including=true; include('config.php'); //Get jackpot info $sql="SELECT * FROM jackpot WHERE `id` = '1'"; $result=mysql_query($sql); $row = mysql_fetch_array( $result ); $prevamount = $row['prevamount']; // $query = "SELECT * FROM grid ORDER BY id ASC"; $result = mysql_query($query); $row = mysql_fetch_array($result); if (isset($_SESSION['loggedin'])){ //if the user has logged in - show the clickable grid if (isset($griderrormsg)){ echo("<center><span style='background-color:white;color:red;font-size:12'>$griderrormsg</span></center>"); //display error } $cell = 0; echo("<TABLE BORDER=3 RULES=NONE FRAME=BOX width='20' border='0' cellspacing='0' cellpadding='0'"); for($i=1; $i<=$gridlength; $i=$i+1){ echo "<tr>"; for($j=1; $j<=$gridwidth; $j=$j+1){ $CurrentCell = $i*$j; if($CurrentCell==$row['id'] && $row['clicked'] > 0){ //if the current cell exists in the database... $clicked = $row['clicked']; $hitby = $row['user']; $row = mysql_fetch_array($result); //Get next result from database }else{// current cell doesn't exist, leave as clickable $clicked = 0; } if ($clicked == "1"){ //if the cell was clicked echo("<td title='$j, $i'><img src='b.gif"); }elseif ($clicked == "2"){ //if the ship was hit echo("<td title='$j, $i - Hit by $hitby'><img src='h.gif"); }elseif ($clicked == "3"){ //if is chest echo("<td title='$j, $i - $prevamount btc won by $hitby'><img src='chest.gif"); }elseif ($clicked == "4"){ //if is click box echo("<td title='$j, $i - Click Box Found By $hitby'><img src='box.png"); }else{ echo("<td><a href='index.php?c=" .($i*$j) . "'><img src='g.gif"); } echo("' BORDER=0></td></a>"); } echo("</tr>"); } echo("</table>"); }else{ //if the user hasnt logged in, show read only grid //To do. } ?>
  8. I rewrote the query and now is working fine. Odd as this code used to work on a previous server. $result = mysql_query("SELECT * FROM grid WHERE id=$nextcell LIMIT 1"); if(mysql_fetch_array($result) == false){ } Thanks for your help.
  9. It also hangs when using: $sql="SELECT * FROM grid WHERE `id` = '$nextcell' LIMIT 1"; $result=mysql_query($sql); if (mysql_fetch_array($result)){ }
  10. I have this same code elsewhere and it runs without a problem Basically, the script wants to put some data in the database, but if the row already exisits, it needs to ignore it. I am using mysql_num_rows for this. $sql="SELECT * FROM grid WHERE `id` = $nextcell LIMIT 1"; $result=mysql_query($sql); $numrows = mysql_num_rows($result); if ($numrows=0){ //nothing here, input data //code to insert } It hangs on the 2nd line. I added "die("$nextcell");" to check it is returning a number, and it does.
  11. VERY sorry to revive this 2+ year thread. But I have reopened my site again (different domain). Back facing this problem. The database needs to hold the info for all of the cells as they contain other data such as if a boat is in that square, or a chest.
  12. Thanks a lot! I don't know how I didn't already know this! Got it working, except that the query adds +'s inbetween words. I have handled this in PHP, but my rewrite script seems to not forward it correctly when +'s are added.
  13. My website is http://www.mp3joe.com I have some rewrite rules setup so if you went to http://www.mp3joe.com/eminem then it would search "eminem". I need to be able to set the URL to the query like above when the user enters it into the search query box. This is so users can bookmark searches. How could I go about doing this? Thanks
  14. Just a thought, but am I doing this the wrong way around? I was linking from a main page to the download.php pages with the ID for the file. Should I be linking instead to the <filename>.html and then the rewite will convert it into "download.php?id=313453" for the script to be called?
×
×
  • 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.