Jump to content

[SOLVED] UPDATE not working properly


TGWSE_GY

Recommended Posts

okay here is my code

 

<?php

$dbhost = "mysql.hmtotc.com";
$dbuser = "thegayestever";
$dbpass = "emit098nice054";
$dbname = "innonmainnj";

$tblrooms = "rooms";
$tbllocations = "directions";
$tblhome = "home";
$tblaccommodations = "accommodations";
$tblreservations = "reservations";
$tblrestaurant = "restaurant";

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());


$indentity = $_POST['indentity'];

if($indentity == "accommodations"){
	$description = addslashes($_POST['accommodations']);
	$query = "UPDATE accommodations SET description='$description' WHERE  id= '1'";
	mysql_query($query) or die(mysql_error());
	header("Location: http://www.innonmainmanasquan.com/admin/index.php?section=3");

}elseif($indentity=="home"){
	$content = addslashes($_POST['content']);
	$promotitle = addslashes($_POST['promotitle']);
	$promo = addslashes($_POST['promo']);
	$address1 = addslashes($_POST['address1']);
	$address2 = addslashes($_POST['address2']);
	$phone = addslashes($_POST['phone']);
	$query = "UPDATE `home` SET  content='$content', promotitle='$promotitle', promo='$promo', address1='$address1', address2='$address2', phone='$phone' WHERE  id= '1'";
	mysql_query($query) or die(mysql_error());
	header("Location: http://www.innonmainmanasquan.com/admin/index.php?section=1");

}elseif($indentity=="locations"){<br />
	$north = addslashes($_POST['north']);
	$south = addslashes($_POST['south']);
	$west  = addslashes($_POST['west']);
	$query = "UPDATE `directions` SET  north='$north', south='$south', west='$west WHERE id='1'";
	mysql_query($query) or die(mysql_error());
	header("Location: http://www.innonmainmanasquan.com/admin/index.php?section=3");

}elseif($indentity=="reservations"){
	$content = addslashes($_POST['description']);
	$phone1 = addslashes($_POST['phone1']);
	$phone2 = addslashes($_POST['phone2']);
	$email = addslashes($_POST['email']);
	$specialtitle = addslashes($_POST['specialtitle']);
	$special = addslashes($_POST['special']);
	$query = "UPDATE `reservations` SET  content='$content', phone1='$phone1', phone2='$phone2', email='$email', specialtitle='$specialtitle', special='$special' WHERE  id='1'";
	mysql_query($query) or die(mysql_error());
	header("Location: http://www.innonmainmanasquan.com/admin/index.php?section=4");

}elseif($indentity=="restaurant"){
	$dinner = addslashes($_POST['dinner']);
	$lunch = addslashes($_POST['lunch']);
	$brunch = addslashes($_POST['brunch']);
	$query = "UPDATE `restaurant` SET  dinner='$dinner', lunch='$lunch', brunch='$brunch' WHERE  id='1'";
	mysql_query($query) or die(mysql_error());
	header("Location: http://www.innonmainmanasquan.com/admin/index.php?section=5");

}elseif(is_numeric($identity)){
	$description = $_POST['description'];
	$cost = $_POST['cost'];
	$query = "UPDATE `rooms` SET  description='$description' cost='$cost' WHERE  roomnumber='$identity'";
	mysql_query($query) or die(mysql_error());
	header("Location: http://www.innonmainmanasquan.com/admin/index.php?section=$identity");
}
?>

 

whats happening is that it is not updating the fields, however it is taking symbols like ' that already exist in the table-collumn and changing it to a ? any ideas?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/175163-solved-update-not-working-properly/
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.