PDA

View Full Version : PHP Confusing Problem... Help :D



Romanity
19-05-2008, 12:11 PM
<?
ob_start();
include("config.php");
?>
<html>
<head>
<title>Home</title>
<link href="housekeeping.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff" class='content'>
<b>Featured Content</b><br />Use this page to update the content in the Large boxes of the main content page.<br><br>
<?
if(isset($logged[username]) && $v[99] == on){
switch($_GET[act]){
default:

$query = mysql_query("SELECT * FROM `settings` WHERE `id` = '17'");
$result = mysql_fetch_array($query);
$shoutout = $result["desc"];

$query3 = mysql_query("SELECT * FROM `settings` WHERE `id` = '14'");
$result3 = mysql_fetch_array($query3);
$shoutout3 = $result3["desc"];

$query2 = mysql_query("SELECT * FROM `settings` WHERE `id` = '15'");
$result2 = mysql_fetch_array($query2);
$shoutout2 = $result2["desc"];

$announce = mysql_query("SELECT * FROM `settings` WHERE `id` = '21'");
$announce2 = mysql_fetch_array($announce);
$announcee = $announce2["desc"];

echo("<form method='post' action='?hk_mode=4&page_view=home_content&act=process'>");

if($v[92] == 'on'){
echo "<br>Official Announcement:<br>
<i>Check to turn <b>ON</b></i> <input type='checkbox' name='announce_status'";
if($announce2[status] == 'on'){ echo "checked"; }
echo "><br><textarea name='announce' rows='10'>$announcee</textarea><br><br>";
}

echo("About OurHabbo: <br><textarea name='box1' rows='10'>$shoutout</textarea><br><br>
OurHabbo Catalogue: <br><textarea name='box2' rows='10'>$shoutout2</textarea><br><br>
Features:<br><textarea name='box3' rows='10'>$shoutout3</textarea><br><br>
<input type='submit' name='send' value='Submit'>
</form>");
break;

case 'process':
$user = $logged[username];
$box1 = addslashes($_POST[box1]);
$box2 = addslashes($_POST[box2]);
$box3 = addslashes($_POST[box3]);
$query = mysql_query("UPDATE `settings` SET `desc` = '$box1', `user` = '$user' WHERE `id` = '17'") or die(mysql_error());
$query2 = mysql_query("UPDATE `settings` SET `desc` = '$box2', `user` = '$user' WHERE `id` = '15'") or die(mysql_error());
$query3 = mysql_query("UPDATE `settings` SET `desc` = '$box3', `user` = '$user' WHERE `id` = '14'") or die(mysql_error());

if($query){ echo "About OurHabbo Updated<br>"; }
if($query2){ echo "OurHabbo Catalogue Updated<br>"; }
if($query3){ echo "Features Updated<br>"; }

if($v[92] == 'on'){
$announce = addslashes($_POST[announce]);
$query4 = mysql_query("UPDATE `settings` SET `desc` = '$announce', `status` = '$_POST[announce_status]', `user` = '$user' WHERE `id` = '21'") or die(mysql_error());
if($query4){ echo "Official Announcement Updated<br>"; }
mysql_query("INSERT INTO `logs` (`id` , `description`, `user`, `date` ) VALUES (NULL , 'Updated Official Announcement', '$logged[username]', '$date')");
}


mysql_query("INSERT INTO `logs` (`id` , `description`, `user`, `date` ) VALUES (NULL , 'Updated Content on Homepage', '$logged[username]', '$date')");

break;
}
}else{
echo("You must be an Adminisitrator to view this!");
}
?>
</body>
</html>


Everything is fine with it, but for some reason when it comes to updating the stuff in the database... it doesnt do it and the database field goes blank, (`desc` just shows and saves as ' ');

Any suggestions?

Want to hide these adverts? Register an account for free!