Code: Select all
<?php
// Server 1, auto-add.php
// Start Session
Session_Start();
// Include
include "config.php";
// Settings
$villageId = "001";
// Loop
while($villageId < 100)
{
// Connect to MySQL and select database
$connect = mysql_connect("$host", "$username", "$password")or die("cannot connect");
// Select database
mysql_select_db("production")or die("cannot select Database");
//Include all the maths of iron mine levels etc...
$data = mysql_query("SELECT * FROM production WHERE villageID=$villageId")
or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
// GOLD
// $Prod* = Production of resources every 60min
$ProdGold = $info['gold'];
// Math
// $Prod* / 3600seconds (60*60)
$ProdGold = $ProdGold / 3600;
// THREE
// $Prod* = Production of resources every 60min
$ProdThree = $info['three'];
// Math
// $Prod* / 3600seconds (60*60)
$ProdThree = $ProdThree / 3600;
// CLAY
// $Prod* = Production of resources every 60min
$ProdClay = $info['clay'];
// Math
// $Prod* / 3600seconds (60*60)
$ProdClay = $ProdClay / 3600;
// IRON
// $Prod* = Production of resources every 60min
$ProdIron = $info['iron'];
// Math
// $Prod* / 3600seconds (60*60)
$ProdIron = $ProdIron / 3600;
// WHEAT
// $Prod* = Production of resources every 60min
$ProdWheat = $info['wheat'];
// Math
// $Prod* / 3600seconds (60*60)
$ProdWheat = $ProdWheat / 3600;
// MySQL close connection
mysql_close($connect);
// Connect to MySQL and select database
$connect1 = mysql_connect("$host", "$username", "$password")or die("cannot connect");
// Select database
mysql_select_db("resources")or die("cannot select Database");
// Gold
// Updates MySQL
mysql_query("UPDATE resources WHERE villageID=$villageId SET gold = gold+$ProdGold");
// Three
// Updates MySQL
mysql_query("UPDATE resources WHERE villageID=$villageId SET three = three+$ProdThree");
// Clay
// Updates MySQL
mysql_query("UPDATE resources WHERE villageID=$villageId SET clay = clay+$ProdClay");
// Iron
// Updates MySQL
mysql_query("UPDATE resources WHERE villageID=$villageId SET iron = iron+$ProdIron");
// Wheat
// Updates MySQL
mysql_query("UPDATE resources WHERE villageID=$villageId SET wheat = wheat+$ProdWheat");
}
// Next village
$villageId ++;
echo mysql_error();
}
?>
<html>
<head>
<!-- Meta refresh every second -->
<meta http-equiv="refresh" content="1">
</head>
<body>
</body>
</html>[text]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE villageID=001 SET wheat = wheat+1.1111111111111' at line 1[/text](two times after each other )
And this is how my MySQL looks like:
[text]Koko tekstit username villageID gold three clay iron wheat
Muokkaa Poista Admin 001 0 0 0 0 0
Muokkaa Poista Admin 002 0 0 0 0 0[/text] ( In finnish
So I really can't see the problem...