Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is the code that sets the query and sends it to my PDO class, which will be below this...
- $sql = new dibdibs\pdo;
- $sql->connect();
- $vals = [
- $_GET['username']
- ];
- if ($sql->numRows("SELECT * FROM `w_a_accounts` WHERE (`name` LIKE %?%)", $vals) > 0){
- $result = $sql->query("SELECT * FROM `w_a_banned-names` WHERE (`name` LIKE %?%)", $vals);
- }
- else{
- $sql->close();
- return "false";
- }
- if ($result['contains'] == 1){
- $sql->close();
- return "true";
- }
- else{
- if ($result['name'] == $_GET['username']){ return "true"; }
- else{ return "false"; }
- }
- //This is the PDO method that prepares statements and executes them
- public function query($query, $valuesUnescaped=[]){
- $statement = $this->con->prepare($query);
- for ($i=0; $i<count($valuesUnescaped); $i++){
- $prepVal = ($valuesUnescaped[$i]);
- $statement->bindParam($i+1, $prepVal);
- }
- $statement->execute();
- $rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
- return $rows;
- }
- //This function works for other queries, but it is throwing errors when using the LIKE clause.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement