Jump to content
MakeWebGames

Itmname to Itmdesc


Recommended Posts

Ok guys, i want to change right here from itmname to itmdesc. I have this line, and i want to change there, at

"You bought '.$_POST['qty'].' '.$itemd['itmname']..." to be desc not name.

 

		$price = ($itemd['itmbuyprice'] * $_POST['qty']);
	item_add($userid, $_GET['ID'], $_POST['qty']);
$db->query("UPDATE `users` SET `money` = `money` - $price WHERE `userid` = $userid");
$db->query("INSERT INTO `itembuylogs` VALUES ('', $userid, {$_GET['ID']}, $price, {$_POST['qty']}, unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for {$price}')");
  echo '<div class="generalinfo_simple"><font color="green"><center><b><div class="statusbox_ok">You bought '.$_POST['qty'].' '.$itemd['itmname'].' '.(($_POST['qty'] > 1) ? 's' : '').' for '.money_formatter($price).'</div></div></b><center></font>';
;
Link to comment
Share on other sites

You mean that or? If is not this tell me where i found it.

 

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');

	$_GET['ID'] = ( isset($_GET['ID'])&&is_numeric($_GET['ID']) )?abs(intval($_GET['ID'])):'';
	$_POST['qty'] = ( isset($_POST['qty'])&&is_numeric($_POST['qty']) )?abs(intval($_POST['qty'])):'';

         if ( empty($_GET['ID']) OR empty($_POST['qty']) ) {
  echo 'Invalid use of file';
         } else {
$q = $db->query("SELECT `itmbuyprice`,`itmname`,`itmbuyable` FROM `items` WHERE `itmid` = {$_GET['ID']}");
if ( $db->num_rows($q) == 0 ) {
  echo 'Invalid item ID';
} else {
$itemd = $db->fetch_row($q);
  if ( $ir['money'] < ($itemd['itmbuyprice'] * $_POST['qty']) ) {
  echo 'You don\'t have enough money to buy '.$_POST['qty'].' '.$itemd['itmname'].'!<br />> <a href="index.php">Go Home</a>';
  die($h->endpage());
  }
  if ( $itemd['itmbuyable'] == 0 ) {
  echo 'This item can\'t be bought!<br />> <a href="index.php">Go Home</a>';
  die($h->endpage());
  } 
$grab_shop = $db->query('SELECT `shopID` FROM `shops` WHERE `shopLOCATION` = '.$ir['location']);
        while ( $list_shop = $db->fetch_row($grab_shop) ) {
	$shots .= $list_shop['shopID'].',';
        }
	$shots .= 0;
	$result_sID = explode(",", $shots);
$grab_sITEM = $db->fetch_row($db->query('SELECT COUNT(`sitemID`) AS `sITEM_CNT` FROM `shopitems` WHERE `sitemSHOP` IN('.$shots.') AND `sitemITEMID` = '.$_GET['ID']));
     if ( $grab_sITEM['sITEM_CNT'] == 0 ) {
  echo 'You can\'t buy items from other cities.<br />> <a href="index.php">Go Home</a>';
  die($h->endpage());
     }

	$price = ($itemd['itmbuyprice'] * $_POST['qty']);
	item_add($userid, $_GET['ID'], $_POST['qty']);
$db->query("UPDATE `users` SET `money` = `money` - $price WHERE `userid` = $userid");
$db->query("INSERT INTO `itembuylogs` VALUES ('', $userid, {$_GET['ID']}, $price, {$_POST['qty']}, unix_timestamp(), '{$ir['username']} bought {$_POST['qty']} {$itemd['itmname']}(s) for {$price}')");
  echo '<div class="generalinfo_simple"><font color="green"><center><b><div class="statusbox_ok">You bought '.$_POST['qty'].' '.$itemd['itmdesc'].' '.(($_POST['qty'] > 1) ? 's' : '').' for '.money_formatter($price).'</div></div></b><center></font>';
}
         }
	$h->endpage();
?>
Edited by S.Cosmin
Link to comment
Share on other sites

$q = $db->query("SELECT `itmbuyprice`,`itmname`,`itmbuyable` FROM `items` WHERE `itmid` = {$_GET['ID']}");

you see this line (l10), this is the code that selects what information will be later into the $itemd variable. So you'll have to select the itmdesc too

change this to (make sure it's the actual correct database field)

 

$q = $db->query("SELECT `itmbuyprice`,`itmname`,`itmdesc`,`itmbuyable` FROM `items` WHERE `itmid` = {$_GET['ID']}");
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...