lpxxfaintxx Posted December 22, 2008 Share Posted December 22, 2008 $marital = form($_POST['marital']); $sexpref = form($_POST['sexpref']); $relview = form($_POST['relview']); $polparty = form($_POST['polparty']); $music = form($_POST['music']); $books = form($_POST['books']); $movies = form($_POST['movies']); $shows = form($_POST['shows']); $aboutme = form($_POST['aboutme']); $userid = form($_POST['userid']); $query = "UPDATE users SET marital='$marital',$sexpref='$sexpref',relview='$relview',polparty='$polparty',music='$music',books='$books',movies='$movies',tv='$shows',aboutme='$aboutme' WHERE user_id='$userid'" ; mysql_query($query) or die ("Error in query: $query"); I get an error, but I can't figure out what I did wrong. I looked at working examples, and they are structured the same. Link to comment https://forums.phpfreaks.com/topic/138058-whats-wrong-with-this-sql-query/ Share on other sites More sharing options...
rhodesa Posted December 22, 2008 Share Posted December 22, 2008 use this instead: mysql_query($query) or die ("Error in query: ".mysql_error()); it will tell you what is wrong most likely thought it's because $sexpref='$sexpref' should be sexpref='$sexpref' Link to comment https://forums.phpfreaks.com/topic/138058-whats-wrong-with-this-sql-query/#findComment-721614 Share on other sites More sharing options...
fenway Posted December 22, 2008 Share Posted December 22, 2008 I get an error, but I can't figure out what I did wrong. Neither can we, since we don't see (a) the actual query sent to the server or (b) the actual error message returned from the server (from mysql_error()). Link to comment https://forums.phpfreaks.com/topic/138058-whats-wrong-with-this-sql-query/#findComment-721615 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.