Updating a mysql database

I am trying to edit a Mysql database. Can someone tell me why this is not working, it doesn't update anything

mysqli_query($con,"UPDATE Users SET day_started=1 WHERE email='$user_data['email']'");

$user_data['email'] works I checked it. I tried echoing it and it did echo the value I wanted. I also checked the database and the value I want it on of the fields in email.

Thank you for your help:)


Try this:

$user_email = mysqli_real_escape_string($con, $user_data['email']);

mysqli_query($con,"UPDATE `Users` SET `day_started`='1' WHERE `email`='".$user_email."'");

I suspect the answer lies with your not properly embedding a PHP variable in your query string. Check out those sexy full stops on each side of $user_email. PHP loves it when you do that.

I also sanitized your input and stuff, and formatted your query with backticks because PHP also loves that.

Need Your Help

JavaFX Transition animation waiting

animation javafx transition command-pattern graph-drawing

so quicky, I am doing program which demonstrate methods used for computer graph drawing. I need to create timeline or history of actions like ( placeVertex(x,y), moveVertex(newX,newY) etc. ) and it...

ASP.NET Productivity Power tools “fix mixed tabs”; which one gives the cleanest HTML?

asp.net visual-studio load-time productivity-power-tools

I have the productivity power tools installed in my Visual Studion 2010 installation. My college frontend developer is working on a mac. When I implement his html in VS, the "fix mixed tabs" compon...