JesterC Posted March 20, 2010 Share Posted March 20, 2010 [mysql]$query = $this->db->execute('SELECT `id`, `username`, `level` FROM `players` WHERE `level`<=?, `username`!=? ORDER BY `level` ASC', array($player->level, $player->username));[/mysql] Can someone tell me how to properly execute this query where level<$player->level & username!=$player->username? somewhere im wrong at [mysql]`username`!=?[/mysql] Quote Link to comment Share on other sites More sharing options...
JesterC Posted March 20, 2010 Author Share Posted March 20, 2010 solved- disregard Quote Link to comment Share on other sites More sharing options...
Zeggy Posted March 20, 2010 Share Posted March 20, 2010 Not sure if this was what you fixed, but when querying tables, the table name should have the prefix <ezrpg>. So for this query you need to select from the table `<ezrpg>players`. :) Oh by the way, this query syntax isn't a mysql error, it's a database class error. Parameter binding isn't used in the php mysql_* functions. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted March 21, 2010 Share Posted March 21, 2010 oh and not everything revloves around your engine, thats why its in MySql :P Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 21, 2010 Share Posted March 21, 2010 Oh and this does so it should be in a board on EzRPG :P Quote Link to comment Share on other sites More sharing options...
Danny696 Posted March 21, 2010 Share Posted March 21, 2010 Are you 100% sure, what is they made the class etc themselves. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 21, 2010 Share Posted March 21, 2010 Are you 100% sure, what is they made the class etc themselves. Are you 100% sure you made sense just then? Anyway get back on topic.. :P Quote Link to comment Share on other sites More sharing options...
Zeggy Posted March 21, 2010 Share Posted March 21, 2010 oh and not everything revloves around your engine, thats why its in MySql :P Like I said in my reply, this was not a mysql error. MySQL doesn't have parameter binding in the language. Parameter binding in mysql is usually implemented through libraries. As far as I know, mcc doesn't use parameter binding and jesterc was asking about ezrpg earlier, so i assumed he was talking about ezrpg. I could be wrong but I doubt it. And yes, I wrote the database class and the method that handles the parameter binding but other database libraries use the same format. Anyways, the problem was fixed, topic should be closed if there's nothing left to comment :P Quote Link to comment Share on other sites More sharing options...
DigitalGerm Posted April 8, 2010 Share Posted April 8, 2010 MySQL doesn't have parameter binding in the language True MySQLi on the other hand has the bind_params() function, replacing the ? the way I see that code should look like $db = new mysqli(); $sql = "SELECT .... FROM ... WHERE x = ? AND z = ?" $query = $db->prepare( $sql ); echo $db->error; $query->bind_param( 'ss', $level, $username ); $query->execute(); or that execute() ? it's a function you made that isn't part of Mysqli? I'm glad you solve it. Quote Link to comment Share on other sites More sharing options...
Zeggy Posted April 8, 2010 Share Posted April 8, 2010 You're right, but you are talking about the mysqli_ library of functions in PHP. I was talking about mysql as a language. If you open mysql in a terminal, can you use bound parameters? Nope. 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.