I am trying to sort out a query on a web app that I'm making, which keeps failing and I have no idea why! The code is below:
$update = $_GET['update'];
if($update == "true"){
$setDetails="UPDATE users SET email='{$_POST['email']}', api_key='{$_POST['api_key']}', api_secret='{$_POST['api_secret']}' WHERE username={$_POST['username']}";
if(mysql_query($setDetails)){
$updatemsg = '<div class="alert alert-success"><a href="#" class="close" data-dismiss="alert">×</a><strong>Success!</strong> Your details have been updated in our database.</div>';
}else{
$updatemsg = '<div class="alert alert-error"><a href="#" class="close" data-dismiss="alert">×</a><strong>Failure!</strong> Your details could not be updated in our database. Please try again later or contact us if this keeps happening.</div>';
}
}else if($update == "false"){
$updatemsg = '<div class="alert alert-success"><a href="#" class="close" data-dismiss="alert">×</a><strong>Success!</strong> Your changed were discarded.</div>';
}
Any idea's, help or tips? Note that further down my web app I have SELECT * FROM users WHERE username='$username'
which works fine so there is no issue with the database connection.