I ave tried to create a mining mod, but I get this error ... Funny thing is, the word inventory appears nowhere in my script.
QUERY ERROR: 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 '' at line 1
Query was SELECT * FROM inventory WHERE inv_userid=1 and inv_itemid=
any hints?
<?php
include('globals.php'); //common stuff
//mine gold
if($ir['energy'] <= 4)
{
echo "You do not have enough energy. Come back later.";
$h->endpage();
exit;
}
if($ir['jail'] || $ir['hospital'])
{
echo "You can't access this page while in the hospital or jail.";
$h->endpage();
exit;
}
$cityname = $db->fetch_single($db->query("SELECT cityname FROM cities WHERE cityid = {$ir['location']}"));
if(isset($_GET['search'])) //search
{
$type = mt_rand(1,11);
$hard = mt_rand(1,3); // 1:3 chance of hard outcome, change this for each differnt ore
$ore = Gold;
$oreid = 115;
$crystal = 116;
$aqua = 117;
$peri = 118;
$Zirc = 119;
$garnet = 120;
$Emerald = 121;
$Saphire = 122;
$Ruby = 123;
$Diam = 124;
$BDimon = 125;
switch($type)
{
case 1:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}else{
$out = "There is nothing here.";
}
break;
case 2:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $crystal, $amt);
$out = "You collected {$amt} Quartz Crystals.";
}
if($hard == 3){
$out = "There is nothing here.";
}
break;
case 3:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $aqua, $amt);
$out = "You collected {$amt} Aquamarine.";
}
if($hard == 3){
$out = "There is nothing here.";
}
break;
case 4:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $peri, $amt);
$out = "You collected {$amt} Peridot.";
}
if($hard == 3){
$out = "There is nothing here.";
}
break;
case 5:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $Zirc, $amt);
$out = "You collected {$amt} Cubic Zirconium.";
}
if($hard == 3){
$out = "There is nothing here.";
}
break;
case 6:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $garnet, $amt);
$out = "You collected {$amt} Garnet.";
}
if($hard == 3){
$out = "There is nothing here.";
}
break;
case 7:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $Emerald, $amt);
$out = "You collected {$amt} Emerald.";
}
if($hard == 3){
$out = "There is nothing here.";
}break;
case 8:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $Saphire, $amt);
$out = "You collected {$amt} Saphire.";
}
if($hard == 3){
$out = "There is nothing here.";
} break;
case 9:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $Ruby, $amt);
$out = "You collected {$amt} Ruby.";
}
if($hard == 3){
$out = "There is nothing here.";
}
case 10:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $Diam, $amt);
$out = "You collected {$amt} Diamond.";
}
if($hard == 3){
$out = "There is nothing here.";
}
case 11:
if($hard == 1){
$amt = mt_rand(1,3);
item_add($userid, $oreid, $amt);
$out = "You collected Some Gold Ore.";
}
if($hard == 2){
$amt = mt_rand(1,3);
item_add($userid, $BDimon, $amt);
$out = "You collected {$amt} Blue Diamond.";
}
if($hard == 3){
$out = "There is nothing here.";
}
}
$db->query("UPDATE users SET energy = energy- 3 WHERE userid = {$userid}"); //decrement energy
?>
<div style="text-align:center">
<?= $out ?>
<?= ($ir['energy']-3> 0) ? "<a href=\"?\">Search again?</a>" : "" ?>
</div>
<?php
}
else //index
{
?>
<h2 style="text-align:center;"><?= $cityname ?> Pond</center></h2>
<div style="text-align:center;">
Welcome to the Mines, <?= $ir['username'] ?>. Mining Gold in Purgatory takes energy. Every time you mine, you energy loose 3 energy.
Click on the image to Choose your ore!
[img=/Oridian/upload/images/pond.png]</center>
<map name='Map'>
<area shape='rect' coords='2,2,66,66' href="?search">
<area shape='rect' coords='69,2,134,66' href="?search">
<area shape='rect' coords='138,2,202,66' href="?search">
<area shape='rect' coords='205,2,270,66' href="?search">
<area shape='rect' coords='274,2,338,66' href="?search">
<area shape='rect' coords='340,2,407,66' href="?search">
<area shape='rect' coords='2,70,66,133' href="?search">
<area shape='rect' coords='69,70,136,133' href="?search">
<area shape='rect' coords='137,70,202,133' href="?search">
<area shape='rect' coords='205,70,270,133' href="?search">
<area shape='rect' coords='274,70,338,133' href="?search">
<area shape='rect' coords='340,70,407,133' href="?search">
<area shape='rect' coords='2,138,405,202' href="?search">
<area shape='rect' coords='69,138,406,202' href="?search">
<area shape='rect' coords='137,138,338,202' href="?search">
<area shape='rect' coords='205,138,271,202' href="?search">
<area shape='rect' coords='274,138,338,202'href="?search">
<area shape='rect' coords='340,138,407,202' href="?search">
<area shape='rect' coords='2,206,66,270' href="?search">
<area shape='rect' coords='69,206,136,270' href="?search">
<area shape='rect' coords='137,206,202,270' href="?search">
<area shape='rect' coords='205,206,270,270' href="?search">
<area shape='rect' coords='274,206,338,270' href="?search">
<area shape='rect' coords='340,206,407,270' href="?search">
<area shape='rect' coords='2,273,66,337' href="?search">
<area shape='rect' coords='69,273,136,337' href="?search">
<area shape='rect' coords='137,273,202,337' href="?search">
<area shape='rect' coords='205,273,270,337' href="?search">
<area shape='rect' coords='274,273,338,337' href="?search">
<area shape='rect' coords='340,273,407,337' href="?search">
<area shape='rect' coords='2,341,66,405' href="?search">
<area shape='rect' coords='69,341,136,405' href="?search">
<area shape='rect' coords='137,341,202,405' href="?search">
<area shape='rect' coords='205,341,270,405' href="?search">
<area shape='rect' coords='274,341,338,405' href="?search">
<area shape='rect' coords='340,341,407,405' href="?search">
<area shape='rect' coords='2,410,66,473' href="?search">
<area shape='rect' coords='69,410,136,473' href="?search">
<area shape='rect' coords='137,410,202,473' href="?search">
<area shape='rect' coords='205,410,270,473' href="?search">
<area shape='rect' coords='274,410,338,473' href="?search">
<area shape='rect' coords='340,410,407,473' href="?search">
</map>
</div>
<?php
}
$h->endpage();
?>