Jump to content

I need help with Querying a DB with PHP

jamesisninja

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

 

EDIT: I Finally fixed it after an hour of troubleshooting, let dis thread die.

Case: NZXT H440 | CPU: i5 4670K @ 4.5 GHz | GPU: MSI 970, Kraken G10 | Mobo: ASRock Z97 Extreme3 | Cooler: H100i | PSU: Corsair AX750 w/ Sleeved Cables | Display: 3xBenQ RL2455M | Fans: 5xNoctua NF-F12, 1xBitFenix Spectre |

Link to comment
Share on other sites

Link to post
Share on other sites

Make sure you properly cast and secure your $_POST's and user input variables... If it's a localhost thing, disregard this message :P

Link to comment
Share on other sites

Link to post
Share on other sites

I'd say use the build in mysql_ methods to connect, execute and query with mysql

 

so to connect use $connect = mysql_connect("HOST", "USER", "PASSWORD") or die ("Failed to connect");

to select a database use mysql_select_db("DATABASE") or die("Could not connect to database");

to query use $query = mysql_query("SELECT * FROM users WHERE email='$email'");

etc......

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×