php - Mysql error in a search script -
I have created a script to search for specific profiles in a database.
if (! Bottom ($ playerListName)) {$ searchQuery. = 'WHERE'% 'like the player's name $ PlayerListName. '%' And playerstats = 1 '; } If ($ playerAge!) {$ SearchQuery. = (! Empty ($ searchQuery)? 'And': 'WHERE'). 'Player edge =' '. $ Player ahead. ' ''; '; } If (is_numeric ($ playerSex)) {$ searchQuery = (! Empty ($ searchQuery)? 'And': 'WHERE'). 'PlayerSex =' $ Player.Sex. "And PlayerStatus = 1 ';} if (! Empty ($ player term)) $ {search query. = (Empty ($ search query)?' And ':' WHERE ').' PlayerPosition = ''. $ Player post '' and playerstats = 1 ';} if (! (Player player citizenship!) {$ SearchQuery. = (! Empty ($ search query)' 'and': 'WHERE') 'Player citizenship =' '$ player citizenship' 'and PlayerStatus = 1';} So far, very good. This string of code:
if (is_numeric ($ playerSex)) {$ SearchQuery = (! Empty ($ discovered)? 'And': 'WHERE'). 'PlayerSacks ='. $ Player sx; Displays the player according to sex, but if I add:
"and playerstats = 1 '; $ Search = (! Empty ($ discovered)? 'And': 'WHERE') 'playerSex =' $ Player.Sex "And PlayerStatus = 1 '; I get this error:
There is an error in your SQL syntax; On line1" 1 '' corresponds to your MySQL server version for the correct syntax.
Why I do not understand: - ( Remove duplicate quote at the beginning of
"and playerstats = 1"; ^ - ------------------------------- here and it A change of location.
Comments
Post a Comment