peterisgb Posted November 24, 2011 Share Posted November 24, 2011 hi, I'm trying to add Weapon Power into a page but the code for some reason does not work, as i'm still learning it could be tottally wrong, heres the code $p=$db->query("SELECT * FROM items WHERE itmid IN({$ir['weapon']})"); while($h=$db->fetch_row($p)) { $equip[$r['itmid']]=$h; } the table is items and the query is called weapon, thanks Quote Link to comment Share on other sites More sharing options...
sniko Posted November 24, 2011 Share Posted November 24, 2011 Well, as this is mccodes, the field names for you weapons are; equip_primary equip_secondary This is with by default anyway, unsure if you've changed it. Now, to select the weapon power from an item, you would do; <?php /* * Make sure $ir is global'd, if needed. * Show weapon power */ $get = $db->query("SELECT `weapon` FROM `items` WHERE `itmid`={$ir['equip_primary']}"); $r = $db->fetch_row($get); echo "Item Power: {$r['weapon']}"; ?> And that will display your weapon power. Sniko. 1 Quote Link to comment Share on other sites More sharing options...
peterisgb Posted November 24, 2011 Author Share Posted November 24, 2011 Well, as this is mccodes, the field names for you weapons are; equip_primary equip_secondary This is with by default anyway, unsure if you've changed it. Now, to select the weapon power from an item, you would do; <?php /* * Make sure $ir is global'd, if needed. * Show weapon power */ $get = $db->query("SELECT `weapon` FROM `items` WHERE `itmid`={$ir['equip_primary']}"); $r = $db->fetch_row($get); echo "Item Power: {$r['weapon']}"; ?> And that will display your weapon power. Sniko. Works a charm, thanks sniko +1 Quote Link to comment Share on other sites More sharing options...
sniko Posted November 24, 2011 Share Posted November 24, 2011 Works a charm, thanks sniko +1 No worries at all. Glad I could help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.