i removed urlencode.. funny enough, I am now getting a value for the teamH, but now my query won't work trying to match Abbey\'s to Abbey's...

My teamH alert produces this: Abbey\'s Wrecking Crew

MySQL error = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'s Wrecking Crew AND division = 'a' ORDER BY id' at line 1

So I think your right about having to url encode the string, it seems to be trying to match the back end of the string, in the case of "May the bulls be with you", it tries to match "the bulls be with you". "510 Heat" tries to match "Heat", etc..

It seems that your statement preparation doesn't work correctly. This issue happens when you pass in a string as value but the value is not a continuous string.

// A query for SQL as
Select * from teams Where team=510 Heat

// is not the same as
Select * from teams Where team='510 Heat'

And you get the error for 's because there is an extra quotation which causes mismatched quotation mark. You need to escape it before you use in your query. Escape is to add 2 backslash chars before it.

Select * from teams Where team='Abbey\\'s Wrecking Crew'

Not sure how much knowledge you have in SQL language...

I am learning as I go along, mainly because I am the only one with any coding skills in the organization. The single quotes around my teamH match worked...

How do I add the two \\ escaping characters to the code because the values are taken from the database right?! When I generate the drop down, the only reference to the team names is this: $team

The query now filters fine based on team chosen it shows the appropriate players on that team.
I just need to get rid of that backslash preceding apostrophes.

Also when I make the player query I grab the players "id" I have been trying to have the id of the player populate a div or a table cell but the way I thought it was done is not working.

In the findplayer.php, I added


then put this in also:

<div id="idP" style="float:left;"><?=$id?></div>

I am guessing I need another onchange event, but couldn't get one to work.
The player list that is generated has the correct player id as its value, so I can retrieve player's rating (from another table) based on the id which is my primary key.

Yes, I am a little confused, appreciate the help.


ok, I finally got the player id to print out. I also forgot I entered only 20 "fake" ratings in the database. I realized this this morning and picked a player with an id of < 20 and viola... I retrieved the rating. Still unsure about removing the \' .

In order to escape a characters for database, you just need to replace the character of the string. You have to replace each "\" with "\\\".

I have no clue how to do that sorry.

Maybe you could use $str = addslashes($str); to escape backslashes & special characters? I just searched on the Internet because I don't code in PHP anymore.

Awesome it worked, I forget where I tried it, but I thought I tried it, apparently not.
Stay tuned, I am sure to start a whole new thread regarding this project, but for now Thanks for your help!