Jump to content

UPDATE


ecabrera

Recommended Posts

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
}

?>

Link to comment
Share on other sites

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());

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.