ecabrera Posted March 31, 2012 Share Posted March 31, 2012 any reason why this may not be updating <?php if(isset($_POST['submitbtn'])){ //will open up the db connection require_once"../includes/connect.php"; $errors = ""; $welcometitle = mysql_real_escape_string($_POST['welcometitle']); $welcomesection = mysql_real_escape_string($_POST['welcomesection']); $infotitle = mysql_real_escape_string($_POST['infotitle']); $infosection = mysql_real_escape_string($_POST['infosection']); $videotitle = mysql_real_escape_string($_POST['videotitle']); $videosection = mysql_real_escape_string($_POST['videosection']); if(isset($welcometitle, $welcomesection) && !empty($welcometitle) && !empty($welcomesection)){ if(isset($infotitle, $infosection) && !empty($infotitle) && !empty($infosection)){ if(isset($videotitle, $videosection) && !empty($videotitle) && !empty($videosection)){ //adding them to the db $query = mysql_query("UPDATE `home` SET `welcometitle`=`$welcometitle`,`welcomesection`=`$welcomesection`,`infotitle`=`$infotitle`, `infosection`=`$infosection`,`videotitle`=`$videosection`"); header("location: http://www.website.org/control/edithome"); }else{ $errors = "Please fill in the Video Section"; } }else{ $errors = "Please fill in the Info Section"; } }else{ $errors = "Please fill in the Welcome Section"; } mysql_close();//will close the inlcude db connection } ?> Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/ Share on other sites More sharing options...
Proletarian Posted March 31, 2012 Share Posted March 31, 2012 Does this work instead? $query = mysql_query("UPDATE home SET welcometitle='$welcometitle', welcomesection='$welcomesection', infotitle='$infotitle', infosection='$infosection', videotitle='$videosection'"); Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332898 Share on other sites More sharing options...
ecabrera Posted March 31, 2012 Author Share Posted March 31, 2012 nope Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332900 Share on other sites More sharing options...
AyKay47 Posted March 31, 2012 Share Posted March 31, 2012 field values are not wrapped in back-ticks, they are wrapped in quotes. $query = mysql_query("UPDATE `home` SET `welcometitle`= '$welcometitle', `welcomesection`= '$welcomesection', `infotitle`='$infotitle', `infosection`= '$infosection',`videotitle`= '$videosection'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332901 Share on other sites More sharing options...
ecabrera Posted March 31, 2012 Author Share Posted March 31, 2012 doesnt work im going to try the phpmyadmin sql and seee what happens Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332903 Share on other sites More sharing options...
ecabrera Posted March 31, 2012 Author Share Posted March 31, 2012 ok mysql tellls me to add this //adding them to the db $query = mysql_query(" UPDATE `home` SET `welcometitle`=$welcometitle,`welcomesection`=$welcomesection,`infotitle`=$infotitle,`infosection`= $infosection,`videotitle`=$videotitle,`videosection`=$videosection "); but doesnt work Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332904 Share on other sites More sharing options...
Proletarian Posted March 31, 2012 Share Posted March 31, 2012 "What" doesn't work? Give some more details. Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332905 Share on other sites More sharing options...
ecabrera Posted March 31, 2012 Author Share Posted March 31, 2012 oki got it to work i have was useing UPDATE and I didn't have anything INSERT INTO the database Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332906 Share on other sites More sharing options...
AyKay47 Posted March 31, 2012 Share Posted March 31, 2012 oki got it to work i have was useing UPDATE and I didn't have anything INSERT INTO the database nice Quote Link to comment https://forums.phpfreaks.com/topic/260045-update/#findComment-1332909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.