General

Tech

Help with querying Sql Db from Php

So... My PHP code just won't work for me, I've been trying to fix this for awhile now, I can't figure out what is wrong. The user selects a team name, and role from 2 drops downs that are populated straight from the Database so there can't be a spelling error, the database is already populated so it just has to update, but with the variables it won't work. I can't find why. It works fine if I change the variables to just strings.

http://pastebin.com/YjckxbUU

February 3, 2014

3 Comments • Newest first

CTBlack

Looks to me its the update statement, I think the columns you are updating are string type, you need to enclose the $playname, $teamname and $rolename in single quotes as in:

set playname = '$playname', teamname = '$teamname', rolename = '$rolename'

Reply February 4, 2014
JamesInNinja

[quote=Dauntaro]why are you using POST and not GET isn't that the wrong one

edit not that I remember how I used to do this stuff lol[/quote]
All of the data in a GET request is carried in the URL, which has a size limitation and is also visible to the user. A POST hides fields (IE Passwords etc) from being visible in the URL, cleans up URLS. GETs are mostly useful when using website search functions, otherwise most websites will be using POST methods to send information. More user friendly.

Reply February 3, 2014
Dauntaro

why are you using POST and not GET isn't that the wrong one

edit not that I remember how I used to do this stuff lol
edit2 you shouldn't name two different objects as the same thing fyi "$teamName = $_POST['teamName'];";"SET playName=$playName" and I'm not sure if you use the $ variable-indicator when referencing the variable

Reply February 3, 2014 - edited