Jump to content

noj75

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

noj75's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Jcbones you are a star !! Works a treat thank you very much !! Out of curiosity what is the extra @$ for before @$$r['month'] Many thanks
  2. That will only display the months that contain data. I need to display Jan through to Dec and numrically display how many entries that month has even if it is zero. Thanks for that but any other ideas. Kind regards
  3. Hi Guys, Im sure there is a way to simplify this into one query or something. Anyone have any ideas: <?php $mqry1 = "SELECT * FROM $blog WHERE month = 'January'"; $mqry2 = "SELECT * FROM $blog WHERE month = 'February'"; $mqry3 = "SELECT * FROM $blog WHERE month = 'March'"; $mqry4 = "SELECT * FROM $blog WHERE month = 'April'"; $mqry5 = "SELECT * FROM $blog WHERE month = 'May'"; $mqry6 = "SELECT * FROM $blog WHERE month = 'June'"; $mqry7 = "SELECT * FROM $blog WHERE month = 'July'"; $mqry8 = "SELECT * FROM $blog WHERE month = 'August'"; $mqry9 = "SELECT * FROM $blog WHERE month = 'September'"; $mqry10 = "SELECT * FROM $blog WHERE month = 'October'"; $mqry11 = "SELECT * FROM $blog WHERE month = 'November'"; $mqry12 = "SELECT * FROM $blog WHERE month = 'December'"; $mres1 = mysql_query($mqry1); $mres2 = mysql_query($mqry2); $mres3 = mysql_query($mqry3); $mres4 = mysql_query($mqry4); $mres5 = mysql_query($mqry5); $mres6 = mysql_query($mqry6); $mres7 = mysql_query($mqry7); $mres8 = mysql_query($mqry8); $mres9 = mysql_query($mqry9); $mres10 = mysql_query($mqry10); $mres11 = mysql_query($mqry11); $mres12 = mysql_query($mqry12); $cmres1 = mysql_num_rows($mres1); $cmres2 = mysql_num_rows($mres2); $cmres3 = mysql_num_rows($mres3); $cmres4 = mysql_num_rows($mres4); $cmres5 = mysql_num_rows($mres5); $cmres6 = mysql_num_rows($mres6); $cmres7 = mysql_num_rows($mres7); $cmres8 = mysql_num_rows($mres8); $cmres9 = mysql_num_rows($mres9); $cmres10 = mysql_num_rows($mres10); $cmres11 = mysql_num_rows($mres11); $cmres12 = mysql_num_rows($mres12); echo '<ul id="monthul"> <li><a href="index.php?month=January">January</a> ('.$cmres1.')</li> <li><a href="index.php?month=February">February</a> ('.$cmres2.')</li> <li><a href="index.php?month=March">March</a> ('.$cmres3.')</li> <li><a href="index.php?month=April">April</a> ('.$cmres4.')</li> <li><a href="index.php?month=May">May</a> ('.$cmres5.')</li> <li><a href="index.php?month=June">June</a> ('.$cmres6.')</li> <li><a href="index.php?month=July">July</a> ('.$cmres7.')</li> <li><a href="index.php?month=August">August</a> ('.$cmres8.')</li> <li><a href="index.php?month=September">September</a> ('.$cmres9.')</li> <li><a href="index.php?month=October">October</a> ('.$cmres10.')</li> <li><a href="index.php?month=November">November</a> ('.$cmres11.')</li> <li><a href="index.php?month=December">December</a> ('.$cmres12.')</li> </ul>'; ?> Any help would be appreciated. Regards
  4. Hi all, Thank you all anyway but I have finally figured it out. Many thanks to those who tried to help. Regards
  5. Thanks for that, I have now chosen a different approach using cron jobs and a mixture of PHP and JS. I have set up a cron job that updates two tables every 5 minutes. The first table is to update the players rep by 1 point. The second updates the current time "h:i:s" to show when it was updated. All that is in a seperate file. I am trying to use the code below to work out the last time the cron was updated, then minus the current time from that which will then give me time left untill the next cron update. I need to convert that to seconds and enter the value into the JC code "secs". Please see the code below: <?php $dTqry = "SELECT * FROM $mycrondb"; $dTres = mysql_query($dTqry); $dTrow = mysql_fetch_array($dTres); $dbtime = $dTrow['timed']; // h:i:s stored in the database eg: 10:02:39 $dbt = date('h:i:s', $dbtime); // database value $crt = date('h:i:s'); // current time $newtime = $crt - $dbt; // trying to get the difference ?> <script type="text/javascript"> /* START TIMER */ var timeInSecs; var ticker; function startTimer(secs) { timeInSecs = parseInt(secs); ticker = setInterval("tick()", 1000); } function tick( ) { var secs = timeInSecs; if (secs > 0) { timeInSecs--; } else { clearInterval(ticker); startTimer(300); // start again from 5 minutes } var mins = Math.floor(secs/60); secs %= 60; var pretty = ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs; document.getElementById("countdown").innerHTML = pretty; } startTimer(<?php echo $newtime; ?>); // time left untill next cron update </script> <span id="countdown" style="font-size:12px;"></span> Now I am totally stuck on how to finish this little script. Anyone have any ideas? Kindest regards
  6. Hi Paystey, your explanation is very interesting and sounds safe, could you possibly help me further? I really would like to find a solution. Willing to pay if required (reasonable amount) :-\
  7. Please could you show me this in detail. As i said, I dont knoe javascript or Ajax. regrds
  8. Hi all, For the last week I have been pulling my hair out trying to figure out how to impliment a timer into my pages and have it countdown from 4 minutes 59 seconds. A simple countdown using javascript would solve the coundown issue but I need the timer to remain the same on everypage as it counts down - !important. Once it has counted down I need to execute a mysql query and then it starts again from 4mins 59secs. (Like mobwars or mafiawars for cash/energy). I found this on another website but dont know how to fill in the blanks: <?php session_start(); //to reset the saved countdown if (!empty($_REQUEST['resetCountdown'])) { unset($_SESSION['startTime']); } if (empty($_SESSION['startTime'])) { $_SESSION['startTime'] = time(); } //In seconds $startTime = time() - $_SESSION['startTime']; ?> <script type="text/javascript"> var countdown = 60; //in seconds var startTime = <?php echo $startTime; ?>; startCountdown(startTime, countdown); function startCountdown(startFrom, duration) { //countdown implementation } </script> <?php echo $startTime; ?> That is a start but when the page is refreshed it shows the counter going up? As I said I need the counter to perminantly display whilst counting down, accross ALL pages, execut a query, start again. I would really appreciate it if any of you top coders out there could help me finish it. I am a beginner at PHP and know NOTHING about javascript. PLEASE HELP, its driving me MAD !! :'( Many kind regards.
  9. Problem solved. I changed the modal to Ajax rather than iFrame and turned off cache. Works a treat now.
  10. Thats just it, I dont have any addons on my FF installation.
  11. The above code IS called inside a jquery iFrame popup though !
  12. Hi all, I am trying to get this code to update a gamers database field by 10 each time the query is run. The code is working fine in IE but for some reason it adds 30 in Firefox when it is supposed to add 10. Anyone any ideas on why its doing this? Is it something to do with the sessions? $mastery = $row['mastery']; /* Current mastery */ if($mastery == '0') { $mastery = '10'; } elseif($mastery > '0') { $mastery = $mastery + '10'; } if($row['mastery'] == '90') { $mastery = '0'; } $uqry = "UPDATE $table SET "; $uqry .= "mastery = '".$mastery."' "; $uqry .= "WHERE gamerid = '".mysql_real_escape_string($_SESSION['gid'])."'"; $ures = mysql_query($uqry);
  13. LOL by "sussed it" I meant the stuff after the query. I got myself stumped on how to display it :-\ Thanks very much for your help with the query mate, very kind.
×
×
  • 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.