How can I check a column that contains a string?

advertisements

currently I've been using this:

SELECT * FROM `meow` WHERE profile LIKE '%$username%'

But the problem I'm facing is if someone puts the letters 'a' it will pull everything that contains a and that's a bit of a security risk on my end, How do i search just 1 column to see if it matches $username exactly? not the whole table?


For exact string matching you should the = operator instead of the like operator:

SELECT * FROM `meow` WHERE profile = '$username'