Jump to content

Search the Community

Showing results for tags 'hour'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hai guys, I'm programming something like a text-based game now, but I've a question.. I want to have a script running, that updates every hour (01:00, 02:00, etc.) the values of some MySQL tables. I've now something like this, but I don't know if this is the right way to do it. So do you guys have any tips to do something like this? Thanks in advance. Updater.php: if (date("i", time()) == "00") { while($x = mysql_fetch_object($dbres)) $update[$x->name] = $x->time; if(floor($update['hour']/3600) != floor(time()/3600)) { $dbres = mysql_query("SELECT GET_LOCK('hour_update',0)"); if(mysql_result($dbres,0) == 1) { $cron_pass = "secretcronpassword"; mysql_query("UPDATE `cron` SET `time`='".time()."' WHERE `name`='hour'"); include("_cron_hour.php"); mysql_query("SELECT RELEASE_LOCK('hour_update')"); } } } _cron_hour.php: if($cron_pass != "secretcronpassword") exit; $dbres = mysql_query("SELECT * FROM `aandelen`"); while($aandeel = mysql_fetch_object($dbres)) { $koersmin = rand(1,500); $koersplus = rand(1,500); mysql_query("UPDATE `aandelen` SET `koers`=`koers`+$koersplus WHERE `naam`='".$aandeel["naam"]."'"); mysql_query("UPDATE `aandelen` SET `koers`=`koers`-$koersmin WHERE `naam`='".$aandeel["naam"]."'"); } if($aandeel["koers"] < 2500) { mysql_query("UPDATE `aandelen` SET `koers`=10000 WHERE `naam`='".$aandeel["naam"]."'"); } $sql1 = mysql_query("SELECT * FROM users WHERE uurloon='1' AND familie <> 'Geen'"); if (mysql_num_rows($sql1)>0) { while($info2 = mysql_fetch_array($sql1)) { $row = mysql_fetch_assoc(mysql_query("SELECT * FROM families WHERE name='".$info2["familie"]."'")); mysql_query("UPDATE users SET cash='".($info2["cash"]+((($row["aandelen"]*200)/100)*25))."', bank='".($info2["bank"]+((($row["aandelen"]*200)/100)*75))."' WHERE login='".$info2["login"]."'"); } }
×
×
  • 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.