MDK666 Posted May 5, 2009 Share Posted May 5, 2009 ok everyone im working on editing the attack.php file to include my inventory mod i had released some time ago, i have everything working up to this single line/s and i was wondering if someone can help out? here is the error that i recieve: 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 'ORDER BY rand()' at line 1 Query was SELECT * FROM users WHERE itmid=(0, 0, 0, 0, 0, 0, 0 ORDER BY rand() and here is the code: { $q3=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_armor']}, {$odata['equip_helmet']}, {$odata['equip_boots']}, {$odata['equip_amulet']}, {$odata['equip_braclet']}, {$odata['equip_ring']}, {$odata['equip_special']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } thats the part im getting confused at, i have a few people telling me the codeing is incorrect, and or i should use a array, but i dont know how to use a array along with writing one, i've tried multiple ways, i was thinking of useing this but not sure if it would work: $q3=$db->query("SELECT * FROM users WHERE equipable={$equipable} ORDER BY rand()"); $equipable = array( helmet => array('equip_helmet'), armor => array('equip_armor'), braclet => array('equip_braclet'), boots => array('equip_boots'), amulet => array('equip_amulet'), ring => array('equip_ring'), special => array('equip_special') ); if anyone has any suggestions of fixes for this ill greatly appreciate it. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted May 5, 2009 Share Posted May 5, 2009 Re: [mccode2] problems with a single sql line and need help Is it not common sense to close of your brackets and ()?'s { $q3=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_armor']}, {$odata['equip_helmet']}, {$odata['equip_boots']}, {$odata['equip_amulet']}, {$odata['equip_braclet']}, {$odata['equip_ring']}, {$odata['equip_special']} ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } should be { $q3=$db->query("SELECT i.* FROM items i WHERE i.itmid IN({$odata['equip_armor']}, {$odata['equip_helmet']}, {$odata['equip_boots']}, {$odata['equip_amulet']}, {$odata['equip_braclet']}, {$odata['equip_ring']}, {$odata['equip_special']}) ORDER BY rand()"); if($db->num_rows($q3)) { $mydamage-=$db->fetch_single($q3); } Quote Link to comment Share on other sites More sharing options...
MDK666 Posted May 5, 2009 Author Share Posted May 5, 2009 Re: [mccode2] problems with a single sql line and need help tnks i appreciate it u just helped me fix this mod up :lol: tnks alot for the 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.