format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `name` = '%s'", pName);
If you are asking why, becouse in your first query, you are selecting nothing from accounts where name is Sanady for example, so it doesn`t make sanse, in my version. You are selecting everything from accounts where name is Sanady.