Jump to content


Problem with Admin script


2 replies to this topic

#1 demonix

    Young Padawan

  • Members
  • Pip
  • 26 posts

Posted 09 January 2006 - 02:43 PM

ok here is the script:

<?
session_start();
if($login_username=="") {
Header("Location: login.html");
}
?>
<div align="center">
<?
if($_POST['submit']){
$index = $_POST['index'];
$guild = $_POST['guild'];
$aff = $_POST['aff'];

$connect = include("connect.php");
$sql = 'UPDATE `index` SET `message` = `$index` LIMIT 1;';
if ($connect && mysql_query($sql)) {
   echo "Index Message Updated Successfully.<br />";
} else {
   echo "Error: pages not updated.<br />";
}
$sql = 'UPDATE `guild` SET `message` = `$guild` LIMIT 1;';
if ($connect && mysql_query($sql)) {
   echo "Guild Message Updated Successfully.<br />";
} else {
   echo "Error: pages not updated.<br />";
}
if ($aff == "") {echo "There are no affiliates to add!";}
else {
$sql = "INSERT INTO aff VALUES ('$aff')";

if ($connect && mysql_query($sql)) {
   echo "Affiliates Updated Successfully.<br />";
} else {
   echo "Error: pages not updated.<br />";
}}}
?></div>
<title>Shadow Effect - Admin</title>
<form method="post">
  <table width="200" border="1" align="center">
	<tr>
	  <td><div align="center">Index Events </div></td>
	  <td><textarea id="index" name="index" rows="5" cols="30"><? 
	  include ("connect.php");
	  $result = mysql_query("select * from `index`");
		while($r=mysql_fetch_array($result)) {
$welcome = $r["message"];
echo "$welcome";
	 } ?></textarea></td>
	  <td><div align="center">Guild Events </div></td>
	  <td><textarea id="guild" name="guild" rows="5" cols="30"><? 	  include ("connect.php");
	  $result = mysql_query("select * from `guild`");
		while($r=mysql_fetch_array($result)) {
$message = $r["message"];
echo "$message";
	 } ?></textarea></td>
	  <td><div align="center">
		<p>Add New Affiliate(This will only change if you enter something.) </p>
		</div></td>
	  <td><input type="text" name="Add_new" /></td>
	</tr>
  </table>
  <p align="center">
	<input name="submit" type="submit" value="Submit" onClick='update.php'"/>
	<input name="reset" type="reset" value="Reset" />
	</p>
  <p align="center">&nbsp; </p>
</form>

for some reason, it won't update the rows... any help?

#2 MillerTime

    Young Padawan

  • Members
  • Pip
  • 69 posts

Posted 09 January 2006 - 07:46 PM

$sql = "UPDATE `index` SET `message` = '$index' LIMIT 1";

$sql = "UPDATE `guild` SET `message` = '$guild' LIMIT 1";

try those as your update sql..

#3 demonix

    Young Padawan

  • Members
  • Pip
  • 26 posts

Posted 09 January 2006 - 08:19 PM

yay it worked thank you!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users