I'm having difficulty querying my database using form input for a name. I'm also having to query using between dates and results, both conditions which work just fine. It's only for searching player names that the database craps out and fails to display anything. The if-statements are nested, but there is another before this piece of code which holds the WHERE part of the statement. Like I said, it works just fine for my other two conditionals. It just doesn't like the WHERE...LIKE for some reason I can't figure out.
Can someone verify if this code should work as I think it should?
$c = "player1 LIKE '%" . $playerName . "%'";
Where $c is used in a query command if the if-statement is true (Which in this case is if $playerName is true). $playerName comes from form input.
'.$err.'
'.$sql.'
';` after executing the query you should be able to see what MySQL thinks about the query. (Probably your connection variable is different from $conn. And the syntax may be a bit different if you use PDO instead of mysql. But I hope you get the idea.) – syck Feb 18 '16 at 17:07