0

When I try these with query function it is giving me an error:

query("SELECT * FROM users WHERE username LIKE %?%", $_POST['username']);
query("SELECT * FROM users WHERE username LIKE '%?%'", $_POST['username']);

I'm guessing it's something to do with the single quotes or the percent sign.

2 Answers 2

0

Well, I was also facing this problem yesterday. I guess it's something with the Yahoo services (if your error is something like "Could not connect to Yahoo").

There is no need to add % around ? (placeholder).

And instead of LIKE use =. So your query looks like:

query("SELECT * FROM `users` WHERE username = ?;", $_POST["username"]);

I hope it helps.

0

I don't know if this is the correct solution but I used this code to get around the problem:

$username = "%" . $_POST['username'] . "%";
query("SELECT * FROM users WHERE username LIKE ?", $username);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .