error updating status

Started on the old forum in January 2010 · view the original in the archive · old links redirect here

2 replies · 416 views · started 16 years ago · 5 min read

2 participants
riderz Lead · 975 posts #1

In the methos shop there are moto traider then update status in profile it dnt update the status there

here are the code

sql ibwf_users

shopssid int 100 default 0

core.php

/////////////////////////////////////////get status

function getstatus($uid)
{
  $info = mysql_fetch_array(mysql_query("SELECT perm, plusses FROM ibwf_users WHERE id='".$uid."'"));
  $shopssid = mysql_fetch_array(mysql_query("SELECT shopssid FROM ibwf_users WHERE id='".$uid."'"));
  if(isbanned($uid))
  {
    return "Banned!";
  }

  if($shopssid[0]=='4')
  {
    return "Ferrari Enzo!";
  }else
  if($shopssid[0]=='5')
  {
    return "Porsche Carrera!";
  }else
  if($shopssid[0]=='6')
  {
    return "Bugatti!";
  }else
  if($shopssid[0]=='7')
  {
    return "McLaren F1!";
  }else
  if($shopssid[0]=='8')
  {
    return "Jaguar XJ220!";
  }else
  if($shopssid[0]=='9')
  {
    return "Lamborghini Murcielago!";
  }else
  if($shopssid[0]=='10')
  {
    return "McLaren Mercedes SLR!";
  }else
if($shopssid[0]=='28')
  {
    return "Vibrator!";
  }else
if($shopssid[0]=='29*')
  {
    return "Bratz!";
  }else
if($shopssid[0]=='30')
  {
    return "Beyonce!";
  }else
if($shopssid[0]=='31')
  {
    return "Britney!";
  }else
if($shopssid[0]=='32')
  {
    return "Sexy Biatch!";
  }else
   if($info[0]=='5')
  {
    return "Coder!";
  } if($info[0]=='4')
  {
    return "HeadAdmin!";
  } if($info[0]=='3')
  {
    return "Owner!";
  }
  if($info[0]=='2')
  {
    return "Admin!";
  }else if($info[0]=='1')
  {
    return "Moderator!";
  }else if($info[0]=='3')
  {
    return "Owner!";
  }else{
    if($info[1]<10)
    {
      return "N00b";
    }else if($info[1]<25)
    {
        return "SpaRkl3";
    }else if($info[1]<50)
    {
        return "flaR3";
    }else if($info[1]<75)
    {
        return "flaM3";
    }else if($info[1]<250)
    {
        return "buRst";
    }else if($info[1]<500)
    {
        return "ViTa1";
    }else if($info[1]<750)
    {
        return "Unplugged";
    }else if($info[1]<1000)
    {
        return "GuRu";
    }else if($info[1]<1500)
    {
        return "V.I.P";
    }else if($info[1]<2000)
    {
        return "FaNatic";
    }else if($info[1]<2500)
    {
        return "KNight";
    }else if($info[1]<3000)
    {
        return "VeteRaN";
    }else if($info[1]<4000)
    {
        return "eXpelleR";
    }else if($info[1]<5000)
    {
        return "MasteR";
    }else if($info[1]<10000)
    {
        return "ic0N";
    }else
    {
        return "Unstopable";
    }
  }
}

mshops-func.php

//////////////////////////////////
else

if($action=="useitem3")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle shop",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);
  $credits = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
  $items = mysql_fetch_array(mysql_query("SELECT itemname, itmeprice, itemshopid FROM ibwf_shop WHERE itemid='".$itemid."'"));
  
  $numberitems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shop_Inventory WHERE uid='".$who."' and itemid='".$itemid."'"));
  
  if($numberitems[0]>0)
  {  
  
  echo "<b><u>Use $items[0]</u></b><br/>";
  
  echo "<a href=\"mshops-func.php?action=changest&sid=$sid&itemid=$itemid\">Change Status</a>";

  }else{
  echo "<b><u>You don't have this item in your Inventory.<br/>If you want to use it, go and buy it.</u></b><br/>";
  }
  
  echo "</p>";
  
  echo "<p>"; 
  
  echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
  exit();
    }
//////////////////////////////////
else

if($action=="useitem7")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle shop",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);
  $credits = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$who."'"));
  $items = mysql_fetch_array(mysql_query("SELECT itemname, itmeprice, itemshopid FROM ibwf_shop WHERE itemid='".$itemid."'"));
  
  $numberitems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shop_Inventory WHERE uid='".$who."' and itemid='".$itemid."'"));
  
  if($numberitems[0]>0)
  {  
  
  echo "<b><u>Use $items[0]</u></b><br/>";
  
  echo "<a href=\"mshops-func.php?action=changest&sid=$sid&itemid=$itemid\">Change Status</a>";

  }else{
  echo "<b><u>You don't have this item in your Inventory.<br/>If you want to use it, go and buy it.</u></b><br/>";
  }
  
  echo "</p>";
  
  echo "<p>"; 
  
  echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
  exit();
    }
//////////////////////////////////
else

if($action=="changest")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle shop",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);

  $items = mysql_fetch_array(mysql_query("SELECT itemname, itmeprice, itemshopid FROM ibwf_shop WHERE itemid='".$itemid."'"));  
  $numberitems = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_shop_Inventory WHERE uid='".$who."' and itemid='".$itemid."'"));  
  
  if($numberitems[0]>0)
  {    
  
  $res = mysql_query("UPDATE ibwf_users SET shopssid='".$itemid."' WHERE id='".$who."'");
  if($res){
  echo "Your new Status is $items[0]";
  $itemidd = mysql_fetch_array(mysql_query("SELECT itemid FROM ibwf_shop WHERE itemname='".$items[0]."'"));
  $delitem = mysql_query("DELETE FROM ibwf_shop_Inventory WHERE uid='".$who."' and itemid='".$itemidd[0]."'");
  }else{
  echo "<b><u>Oops, you can't use this status.</u></b><br/>";
  }
  }else{
  echo "<b><u>Oops, you can't use this status.</u></b><br/>";
  }
  
  
  echo "</p>";
  
  echo "<p>"; 
  
  echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
  exit();
    }

mshop.php

//////////////////////////////////

else
if($action=="inventory")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
  $pstyle = gettheme($sid);
      echo xhtmlhead("inventory",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);
  
  echo "<i><b><u><small>Inventory:</small></u></b></i><br/>";

  echo "</p>";
  echo "<p>";
  
     $sql = "SELECT itemid FROM ibwf_shop_Inventory WHERE uid='".$who."'";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
    $shopitem = mysql_fetch_array(mysql_query("SELECT itemid, itemname, itemshopid FROM ibwf_shop WHERE itemid='".$item[0]."'"));
        
    echo "$shopitem[1]<br/>";
    if($shopitem[2]=='1'){
    echo " <small><a href=\"mshops-func.php?action=useitem1&itemid=$shopitem[0]&sid=$sid\">Use Item</a></small><br/><br/>";
    }
    else
    if($shopitem[2]=='2'){
    echo " <small><a href=\"mshops-func.php?action=useitem2&itemid=$shopitem[0]&sid=$sid\">Use Item</a></small><br/><br/>";
    }
    else
    if($shopitem[2]=='3'){
    echo " <small><a href=\"mshops-func.php?action=useitem3&itemid=$shopitem[0]&sid=$sid\">Use Status</a></small><br/><br/>";
    }
 else
    if($shopitem[2]=='7'){
    echo " <small><a href=\"mshops-func.php?action=useitem7&itemid=$shopitem[0]&sid=$sid\">Use Status</a></small><br/><br/>";
    }
    else
    if($shopitem[2]=='4'){
    echo " <small><a href=\"mshops-func.php?action=useitem4&itemid=$shopitem[0]&sid=$sid\">Use Item</a></small><br/><br/>";
    }
      
  }
 }
    
    
    echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"mshop.php?action=main&sid=$sid\">Back to Shop</a><br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
  echo xhtmlfoot();
  exit();
    }
//////////////////////////////////

else
if($action=="shops")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
 $pstyle = gettheme($sid);
      echo xhtmlhead("$stitle Shop",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);
  
  echo "<i><b><u><small>Shops:</small></u></b></i><br/>";

  echo "</p>";
  echo "<p>";  
 
  echo "<a href=\"mshops.php?action=shop3&sid=$sid\">Moto Trader</a><br/>";
 echo "<a href=\"mshops.php?action=shop6&sid=$sid\">Female Trader</a><br/>";
  echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
 echo xhtmlfoot();
  exit();
    }

mshops.php

/////////////////////////////////else

if($action=="shop3")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle shop",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);
  
  echo "<b><u>Moto Trader</u></b><br/>";
  echo "<small>Wanne be known as the fastes chatter around?<br/>Well then buy yourself a new Sport Car Status.</small><br/>";

  echo "</p>";
  echo "<p>";  
  
    $sql = "SELECT itemid, itemname, itmeprice, itemshopid, avail FROM ibwf_shop WHERE itemshopid='3'";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
        
    echo "$item[1]<br/>";
    echo " <small>Price: <b>$item[2]Credits</b></small><br/>";
    echo " <small>Availible: <b>$item[4]</b></small><br/>";
    echo " <small><a href=\"mshops-func.php?action=buy&itemid=$item[0]&sid=$sid\">Buy Status</a></small><br/><br/>";
       
    }
    }
  
  echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
       echo "</p>";
  echo xhtmlfoot();
  exit();
    }
//////////////////////////////////else

if($action=="shop6")
{
  addonline(getuid_sid($sid),"$stitle Shop","");
$pstyle = gettheme($sid);
      echo xhtmlhead("$stitle shop",$pstyle);
  echo "<p align=\"center\">";
  
  $nick = getnick_sid($sid);
  $who = getuid_nick($nick);
  
  echo "<b><u>Moto Trader</u></b><br/>";
  echo "<small>Wanne be known as the Hottest chatter around?<br/>Well then buy yourself a new Hot Status.</small><br/>";

  echo "</p>";
  echo "<p>";  
  
    $sql = "SELECT itemid, itemname, itmeprice, itemshopid, avail FROM ibwf_shop WHERE itemshopid='7'";

    $items = mysql_query($sql);
    echo mysql_error();
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {
        
    echo "$item[1]<br/>";
    echo " <small>Price: <b>$item[2]Credits</b></small><br/>";
    echo " <small>Availible: <b>$item[4]</b></small><br/>";
    echo " <small><a href=\"mshops-func.php?action=buy&itemid=$item[0]&sid=$sid\">Buy Status</a></small><br/><br/>";
       
    }
    }
  
  echo "</p>";
  ////// UNTILL HERE >> 
  echo "<p align=\"center\">";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
  echo "Home</a>";
  echo "</p>";
       echo "</p>";
  echo xhtmlfoot();
  exit();
    }

in profile index=viewuser

echo "Status: <b>".getstatus($who)."</b><br/>";

sql

-- Table structure for table `ibwf_shop`
--

CREATE TABLE IF NOT EXISTS `ibwf_shop` (
  `itemid` int(100) NOT NULL auto_increment,
  `itemname` varchar(100) NOT NULL default '',
  `itmeprice` int(100) NOT NULL default '0',
  `itemshopid` int(100) NOT NULL default '0',
  `avail` int(100) NOT NULL default '0',
  PRIMARY KEY  (`itemid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=28 ;

--
-- Dumping data for table `ibwf_shop`
--

INSERT INTO `ibwf_shop` (`itemid`, `itemname`, `itmeprice`, `itemshopid`, `avail`) VALUES
(2, 'Bunch of Flowers', 50, 2, 6000),
(3, 'Teddy Bear', 110, 2, 1000),
(4, 'Promise Ring', 400, 2, 3000),
(5, 'Cool Beer', 15, 2, 38),
(6, 'Hot Coffee', 10, 2, 25),
(7, 'Red Bull', 35, 2, 1000),
(8, 'Water Bed', 250, 2, 1000),
(9, 'Red Rose', 60, 2, 14),
(10, 'Chocolate', 10, 2, 1000),
(11, 'Ferrari Enzo', 900, 3, 1000),
(12, 'Porsche Carrera', 2000, 3, 5000),
(13, 'Bugatti', 800, 3, 16),
(14, 'Jaguar XJ220', 1300, 3, 1000),
(15, 'Lamborghini Murcielago', 1550, 3, 1000),
(16, 'McLaren Mercedes SLR', 6100, 3, 1000),
(17, 'Blue Diamond', 900, 2, 2000),
(18, 'Thank you Card', 30, 2, 1000),
(19, 'Gold Watch', 200, 2, 8000),
(20, 'T.N.T', 300, 2, 21),
(21, 'condom', 60, 2, 1000),
(22, 'Rubber Snake', 55, 2, 1000),
(23, 'Poison', 65, 2, 4000),
(24, 'Vodka', 210, 2, 34),
(26, 'BirthDay Gift', 100, 2, 57),
(27, 'nicknamechange', 2500, 11, 9999999);
(28, 'vibrator', 5000, 11, 9999999);
(29, 'Bratz', 200, 11, 9999999);
(30, 'Beyonce', 500, 11, 9999999);
(31, 'Britney', 700, 11, 9999999);
(31, 'Sexy Biatch', 800, 11, 9999999);

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

nclemale36 Lead · 537 posts #2

theres a few mistakes in that script mate ,. like it says itme instead of item. .and the shop_inventory when the database is shop_Inventory. i had to play around a bit till i got it too work . looks like your missing ibwf_shop_Inventory table too .

-- --------------------------------------------------------

--
-- Table structure for table `ibwf_shop_Inventory`
--

CREATE TABLE IF NOT EXISTS `ibwf_shop_Inventory` (
  `id` int(100) NOT NULL auto_increment,
  `uid` int(100) NOT NULL default '0',
  `itemid` int(100) NOT NULL default '0',
  `time` int(100) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

--
-- Dumping data for table `ibwf_shop_Inventory`
--

INSERT INTO `ibwf_shop_Inventory` (`id`, `uid`, `itemid`, `time`) VALUES

-- --------------------------------------------------------
riderz Lead · 975 posts #3

I have the shop inventory just didnt post it here


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close