PDA

View Full Version : PHP MySql Errors



Romanity
21-07-2008, 12:02 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 = stripslashes($result["desc"]);

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

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

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

$show_poll = mysql_query("SELECT * FROM `settings` WHERE `id` = '22'");
$show_poll = mysql_fetch_array($show_poll);

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

echo "Show Latest Poll?<br>
Yes <input type='radio' name='show_poll' value='1'"; if($show_poll[status] == '1'){ echo "checked"; } echo "> No <input type='radio' name='show_poll' value='0'"; if($show_poll[status] == '0'){ echo "checked"; } echo "><br>";

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='box' rows='10'>$shoutout</textarea><br><br>
OurHabbo Catalogue: <br><textarea name='boxx' rows='10'>$shoutout2</textarea><br><br>
Features:<br><textarea name='boxxx' rows='10'>$shoutout3</textarea><br><br>
<input type='submit' name='send' value='Submit'>
</form>");
break;

case 'process':
$user = $logged[username];
$box = addslashes($_POST);
$boxx = addslashes($_POST[boxx]);
$boxxx = addslashes($_POST[boxxx]);
$query = mysql_query("UPDATE `settings` SET `desc` = '$box', `user` = '$user' WHERE `id` = '17'") or die(mysql_error()); //BROKEN
$query2 = mysql_query("UPDATE `settings` SET `desc` = '$boxx', `user` = '$user' WHERE `id` = '15'") or die(mysql_error()); //BROKEN
$query3 = mysql_query("UPDATE `settings` SET `desc` = '$boxxx', `user` = '$user' WHERE `id` = '14'") or die(mysql_error()); //BROKEN
$query4 = mysql_query("UPDATE `settings` SET `status` = '$_POST[show_poll]', `user` = '$user' WHERE `id` = '22'") or die(mysql_error()); //BROKEN

if($query){ echo "About OurHabbo Updated<br>"; }
if($query2){ echo "OurHabbo Catalogue Updated<br>"; }
if($query3){ echo "Features Updated<br>"; }
if($query4){ echo "Show Latest Poll 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()); //BROKEN
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>
Right, so the problem is.. it works fine, and i see no errors... but when it updates, every single query thats meant to update something, sets `desc` as a ' ' (no content) rather than the content in the textareas....

Any errors Im missing?

Ive marked up the broken queries

[B]EDIT: Should mention, the queries all run and theres no error returned, so problem = mystery

Dentafrice
21-07-2008, 03:39 PM
change them to



$_POST["box"]
$_POST["boxx"]
$_POST["boxxx"]

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