def getByBothName(bothname): first = bothname[0] last = bothname[1] user = my_database.queryAll("SELECT * FROM users WHERE first_name LIKE %s and last_name LIKE %s", ('%' + first + '%', '%' + last + '%')) return user
def getByLastName(lastname): user = my_database.queryAll("SELECT * FROM users WHERE last_name LIKE %s", ('%' + lastname + '%',)) return user
def getAllUsers(): user = my_database.queryAll("SELECT * FROM users","") return user
def getIdolIdByUsername(username): followed_user = my_database.queryAll( "SELECT follow.idol FROM follow JOIN users ON follow.follower = users.id WHERE users.username = %s", [username]) return followed_user
def getFollower(user_id): followed_by_user = my_database.queryAll( "SELECT users.id, users.username, users.first_name, users.last_name FROM users JOIN follow ON users.id = follow.follower WHERE follow.idol = %s", [user_id]) return followed_by_user
def getIdolId(user_id): followed_user = my_database.queryAll( "SELECT idol FROM follow WHERE follower = %s", [user_id]) return followed_user