Jump to content

A little help needed :)


shujjah

Recommended Posts

Hello people I need some help.Alright here goes I have a comments system and I have an admin panel for that but there is a slight problem with the admin panel that it doesnot show the comments I think there is something wrong with the select statement hopefully you guys can help me out.How does it work that you go to the admin panel you go to comments and you select a news then it is supposed to show you the comments but it doesnt.And there are comments of the news when you open the news it shows the comments and there are so ofcourse comments in the database also the problem is it just isnt showing in the admin panel.Here is my database structuregamecms_comment table structure

	Field Type Collation Attributes Null Default Extra Action   commentId int(11)   No  auto_increment			     assetId int(11)   No 0				  section varchar(10) latin1_general_ci  No				   comment text latin1_general_ci  No				   userName varchar(10) latin1_general_ci  No				   email text utf8_general_ci  No				   timestamp datetime   No 0000-00-00 00:00:00				  auth tinyint(1)   No 0				  deleted tinyint(1)   No 0

And if I browse there are comments it's not empty

  commentId  assetId  section  comment  userName  email  timestamp  auth  deleted  	  1 14 news Testing whether it works or not! SpEeDyZ ameershujjah@hotmail.co.uk 2008-04-18 20:44:37 1 0 	  2 14 news asdhasjkdhasjkdas SpEeDyZ haha@haha.com 2008-04-18 20:45:16 1 0 	  3 14 news asdhasjkdhasjkdas SpEeDyZ haha@haha.com 2008-04-18 20:45:18 1 0 	  4 13 news Blah teststing hat really ? Blah1 ashsd@hasdh.com 2008-04-25 11:45:29 1 0 	  5 13 news asdhasjkdhaksjdhjkas Hehe amemee@hha.com 2008-05-22 12:50:54 1 0

I think this code can explain better

				<td>Choose Comment<font color="#DE7900">*</font>:</td>				<td align="left">				 <select id="commentId" name="commentId" class="select">				  <?				  $sql = "SELECT commentId, comment, userName FROM gamecms_comment WHERE assetId = '$newsId' AND section ='news' AND deleted='0' ORDER BY timestamp DESC";				  $db->query($sql);				  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose Comment --");				  while ($db->next_record()) {					  $id = $db->f("commentId");					  $comment = stripslashes($db->f("comment"));					  $userName = stripslashes($db->f("userName"));					  print("<option value=$id>$userName - $comment\n");				  }				  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  ?>				 </select>				</td>			   </tr>

Link to comment
Share on other sites

Full code

<?php/***************************************************************************** * gameCMS Lite - A Content Management System designed for gaming websites * Copyright (c) 2006-2007 http://www.gamecms.com/ * * File	: news/index.php * Version : 1.1 * Author  : Greg "FireFly" Ellwood *****************************************************************************//***************************************************************************** *  This file is part of gameCMS Lite. * *  gameCMS Lite is free software; you can redistribute it and/or modify it *  under the terms of the GNU General Public License as published by the Free *  Software Foundation; either version 2 of the License, or (at your option) *  any later version. * *  gameCMS Lite is distributed in the hope that it will be useful, but *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *  for more details. * *  You should have received a copy of the GNU General Public License along *  with gameCMS Lite; if not, write to the Free Software Foundation, Inc., *  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *****************************************************************************/define('IN_GAMECMS', true);require_once '../php-bin/db_mysql.inc.php';$db = new DB_Sql();$db2 = new DB_Sql();require_once '../includes/functions.inc.php';require_once '../includes/checkuser.inc.php';if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {	$formName = 'DELETE COMMENTS';	$formDesc = 'Please use the form below to delete comments from your website or choose another link from the menu on the left.';}?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>  <title>gameCMS Lite</title>  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />  <link rel="stylesheet" type="text/css" href="../css/gamecms.css" />  <link rel="stylesheet" type="text/css" href="../css/calendar.css" />  <script src="../js/functions.js"></script>  <script language="javascript" type="text/javascript" src="../js/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script>  <script language="javascript" type="text/javascript"> tinyMCE.init({  mode : "textareas",  theme : "advanced",  plugins : "table,advhr,advimage,advlink,preview,flash,searchreplace,print,contextmenu,paste,fullscreen,noneditable",  theme_advanced_buttons1_add_before : "newdocument,separator",  theme_advanced_buttons1_add : "fontselect,fontsizeselect",  theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor",  theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",  theme_advanced_buttons3_add : "advhr,separator,print,separator,fullscreen",  theme_advanced_buttons3_add_before : "tablecontrols,separator",  theme_advanced_toolbar_location : "top",  theme_advanced_toolbar_align : "left",  theme_advanced_path_location : "bottom",  content_css : "/example_data/example_full.css",  extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",  theme_advanced_resize_horizontal : false,  theme_advanced_resizing : true });  </script>  <script type="text/javascript" src="../js/calendar.js"></script>  <script type="text/javascript" src="../js/calendar-en.js"></script>  <script type="text/javascript" src="../js/calendar-setup.js"></script>  <script language="JavaScript">  function validateChooseNews() {	  if ((document.getElementById('newsId').options[document.getElementById('newsId').selectedIndex].value) == "0") {		  alert("You must choose a News Article from the dropdown list!");		  return false;	  } else {		  document.forms[0].submit();	  }  }   function setNewsId(id) {	  document.getElementById('newsId').value = id;  }  function confirmDelete()  {	  var agree = confirm("Are you sure you wish to delete this comment?");	  if (agree) {		  document.forms[0].submit();	  } else {		  return false;	  }  }  function show(obj) {	  document.getElementById(obj).style.display = '';  }  function hide(obj) {	  document.getElementById(obj).style.display = 'none';  }  </script> </head> <body bgcolor="#475D82" style="margin: 0px;"<?php if ((isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'add') && !(isset($_REQUEST['stage']))) {?>onload="newsCategoryId.focus()"<?php } ?>>  <table width="808" cellspacing="0" cellpadding="0" style="margin-left: 6px;">   <tr style="height: 28px;">	<td width="7" align="right"><img src="../images/formTitleLeft.gif" alt="" /></td>	<td width="794" style="background-image: url(../images/formTitleStretch.gif); background-repeat: repeat-x; text-align: left; font-size: 7pt; font-family: Tahoma; color: #424242;"><span style="position: relative; top: 8px; left: 5px;"><strong><?php echo $formName; ?></strong></span><span style="float: right; position: relative; top: -5px; left: -5px;"><a href="#" onClick="popup('../help/nohelp.htm', 450, 300);"><img src="../images/help.gif" alt="" border="0" /></a></span></td>	<td width="7"><img src="../images/formTitleRight.gif" alt="" /></td>   </tr>  </table>  <table cellspacing="0" cellpadding="0" style="margin-left: 6px;">   <tr style="height: 65px;">	<td width="4" align="right" style="background-image: url(../images/formHeaderLeft.gif); background-repeat: repeat-y;"></td>	<td width="800" bgcolor="#B0C6DE">	 <table width="100%" cellspacing="0" cellpadding="0">	  <tr>	   <td width="80"><img src="../images/siteLogo.gif" width="132" height="65" alt="" /></td>	   <td width="20"> </td>	   <td style="font-family: Tahoma; color: #000000; font-size: 8pt;"><i><?php echo $formDesc; ?></i></td>	  </tr>	 </table>	</td>	<td width="4" style="background-image: url(../images/formHeaderRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr style="height: 2px;">	<td width="4" align="right" style="background-image: url(../images/formDividerLeft.gif); background-repeat: repeat-y;"></td>	<td width="800" style="background-image: url(../images/formDividerStretch.gif); background-repeat: repeat-x;"></td>	<td width="4" style="background-image: url(../images/formDividerRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr>	<td width="4" align="right" style="background-image: url(../images/formContentLeft.gif); background-repeat: repeat-y;"></td>	<td width="800" bgcolor="#C1D2E6" align="center">	 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">	  <table width="730" cellspacing="0" cellpadding="0">	   <tr>		<td style="height: 15px;"></td>	   </tr>	   <?php	   if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'add') {		   if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {			   $timestamp = date("Y-m-d G:i:s");			   //if ($releaseDateTime == "") {				 $releaseDateTime = $timestamp;			   //}			   $newsCategoryId = $_POST['newsCategoryId'];			   if ($newsCategoryId == -2) {				  $sql = "INSERT INTO gamecms_newsCategory values ('', '".safeEscapeString($_POST['newCategory'])."','$userId','0')";				  $db->query($sql);				  $sql = "SELECT newsCategoryId FROM gamecms_newsCategory WHERE newsCategory='".$_POST['newCategory']."' AND deleted='0'";				  $db->query($sql);				  $db->next_record();				  $newsCategoryId = $db->f("newsCategoryId");			   }			   $sql = "INSERT INTO gamecms_news values ('','$userId','".$newsCategoryId."','".safeEscapeString($_POST['subject'])."','".$_POST['shortNews']."','".$_POST['longNews']."','".$_POST['iconId']."','".$_POST['source']."','".$_POST['sourceLink']."','".$_POST['forumLink']."','$releaseDateTime','$timestamp','1','0')";			   $db->query($sql);			   $sql = "SELECT newsId FROM gamecms_news WHERE subject='".safeEscapeString($_POST['subject'])."' AND timestamp='$timestamp'";			   $db->query($sql);			   $db->next_record();			   $newsId = $db->f("newsId");			   $systems = $_POST['systems'];			   $numElements = count($systems);			   for ($i = 0; $i < $numElements; ++$i) {				  $sql = "INSERT INTO gamecms_newsSystemLink values ('', '$newsId','$systems[$i]')";				  $db->query($sql);			   }			   $games = $_POST['games'];			   $numElements = count($games);			   for ($i = 0; $i < $numElements; ++$i) {				  $sql = "INSERT INTO gamecms_newsGameLink values ('', '$newsId','$games[$i]')";				  $db->query($sql);			   }			   printf("<tr><td class=\"text\"><br /><br />Thanks for your news post.<br /><hr /></td></tr>");			   printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");		   } else {			   ?>			   <input type="hidden" name="operation" value="add" />			   <input type="hidden" name="stage" value="2" />			   <tr>				<td class="left" align="right">News Category<font color="#DE7900">*</font>:</td>				<td class="right">				 <select class="select" id="newsCategoryId" name="newsCategoryId" onChange="if (this.value == '-2') { show('newCategoryRow'); } else { hide('newCategoryRow') }">				  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Category --				  <option value="-2" style="background-color: #D5E9FF;" />New				  <option value="-1" style="background-color: #D5E9FF;" />None				  <?				  $sql = "SELECT * FROM gamecms_newsCategory WHERE newsCategoryId > '0' AND deleted='0' ORDER BY newsCategory ASC";				  $db->query($sql);				  while($db->next_record()) {				 ?>				 <option value="<?php echo $db->f("newsCategoryId"); ?>" /><?php echo $db->f("newsCategory"); ?>				 <?				  }				  ?>				  <option value="0" style="background-color: #D5E9FF;" />-- Choose Category --				 </select>				</td>			   </tr>			   <tr id="newCategoryRow" style="display: none;">				<td class="left" align="right">New Category:</td>				<td class="right"><input class="input" type="text" id="newCategory" name="newCategory" maxlength="30" value="" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right"><u>S</u>ubject<font color="#DE7900">*</font>:</td>				<td class="right"><input class="input" type="text" id="subject" name="subject" value="" maxlength="255" accesskey="s" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">Related Systems<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>				<td class="right">				 <select class="select" id="systems[]" name="systems[]" multiple="multiple" style="height: 110px;">				  <?				  $sql = "SELECT * FROM gamecms_system WHERE deleted='0' ORDER BY systemName ASC";				  $db->query($sql);				  while($db->next_record()) {				 ?>				 <option value="<?php echo $db->f("systemId"); ?>" /><?php echo $db->f("systemName"); ?>				 <?				  }				  ?>				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">Related Games:<br /><font size="-2">(Ctrl+click for more than one)</font></td>				<td class="right">				 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">				  <?				  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";				  $db->query($sql);				  while($db->next_record()) {					 $systemId = $db->f("systemId");					 $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";					 $db2->query($sql);					 $db2->next_record();					 $systemAbbrev = $db2->f("systemAbbrev");					 ?>				 <option value="<?php echo $db->f("gameId"); ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>				 <?				  }				  ?>				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">S<u>h</u>ort News:</td>				<td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"></textarea></td>			   </tr>			   <tr>				<td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>				<td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"></textarea></td>			   </tr>			   <tr>				<td class="left" align="right">Icon:</td>				<td class="right">				 <select class="select" id="iconId" name="iconId">				  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --				  <?				  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";				  $db->query($sql);				  while($db->next_record()) {				 ?>				 <option value="<?php echo $db->f("imageId"); ?>" /><?php echo $db->f("comment"); ?>				 <?				  }				  ?>				  <option value="0" style="background-color: #D5E9FF;" />-- Choose Icon --				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right">S<u>o</u>urce:</td>				<td class="right"><input class="input" type="text" id="source" name="source" value="" maxlength="255" accesskey="o" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right"><u>S</u>ource Link:</td>				<td class="right"><input class="input" type="text" id="sourceLink" name="sourceLink" value="" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right"><u>F</u>orum Link:</td>				<td class="right"><input class="input" type="text" id="forumLink" name="forumLink" value="" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td> </td>				<td valign="middle" class="right">				 <button onClick="return validateAddForm();" accesskey="a" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>A</u>dd News</button>				</td>			   </tr>			   <?php		   }	   } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'edit') {		   if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {			   $sql = "UPDATE gamecms_news SET newsCategoryId='".$_POST['newsCategoryId']."',subject='".safeEscapeString($_POST['subject'])."',shortNews='".$_POST['shortNews']."',longNews='".$_POST['longNews']."',iconId='".$_POST['iconId']."',source='".$_POST['source']."',sourceLink='".$_POST['sourceLink']."',forumLink='".$_POST['forumLink']."' WHERE newsId='".$_POST['newsId']."'";			   $db->query($sql);			   $sql = "DELETE FROM gamecms_newsSystemLink WHERE newsId='".$_POST['newsId']."'";			   $db->query($sql);			   $systems = $_POST['systems'];			   $numElements = count($systems);			   for ($i = 0; $i < $numElements; ++$i) {				  $sql = "INSERT INTO gamecms_newsSystemLink values ('', '".$_POST['newsId']."','$systems[$i]')";				  $db->query($sql);			   }			   $sql = "DELETE FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."'";			   $db->query($sql);			   $games = $_POST['games'];			   $numElements = count($games);			   for ($i = 0; $i < $numElements; ++$i) {				  $sql = "INSERT INTO gamecms_newsGameLink values ('', '".$_POST['newsId']."','$games[$i]')";				  $db->query($sql);			   }			   printf("<tr><td class=\"text\"><br /><br />Thanks for your edit.<br /><hr /></td></tr>");			   printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");			} else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {			   $sql = "SELECT * FROM gamecms_news WHERE newsId='".$_POST['newsId']."'";			   $db->query($sql);			   $db->next_record();			   $newsCategoryId = $db->f("newsCategoryId");			   $subject = $db->f("subject");			   $shortNews = $db->f("shortNews");			   $longNews = $db->f("longNews");			   $iconId = $db->f("iconId");			   $source = $db->f("source");			   $sourceLink = $db->f("sourceLink");			   $forumLink = $db->f("forumLink");			   $releaseDateTime = $db->f("releaseDateTime");			   ?>			   <input type="hidden" name="operation" value="edit" />			   <input type="hidden" name="stage" value="3" />			   <input type="hidden" name="newsId" value="<?php echo $_POST['newsId']; ?>" />			   <tr>				<td class="left" align="right">News Category<font color="#DE7900">*</font>:</td>				<td class="right">				 <select class="select" id="newsCategoryId" name="newsCategoryId">				  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Category --				  <option value="-1" style="background-color: #D5E9FF;" />None				  <?				  $sql = "SELECT * FROM gamecms_newsCategory WHERE newsCategoryId > '0' AND deleted='0' ORDER BY newsCategory ASC";				  $db->query($sql);				  while($db->next_record()) {					  $id = $db->f("newsCategoryId");					  ?>					  <option value="<?php echo $id; ?>" <?php If ($id == $newsCategoryId) { echo "selected=\"selected\""; } ?> /><?php echo $db->f("newsCategory"); ?>					  <?				  }				  ?>				  <option value="0" style="background-color: #D5E9FF;" />-- Choose Category --				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right"><u>S</u>ubject<font color="#DE7900">*</font>:</td>				<td class="right"><input class="input" type="text" id="subject" name="subject" value="<?php echo $subject; ?>" maxlength="255" accesskey="s" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">Related Systems<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>				<td class="right">				 <select class="select" id="systems[]" name="systems[]" multiple="multiple" style="height: 120px;">				  <?				  $sql = "SELECT * FROM gamecms_system WHERE deleted='0' ORDER BY systemName ASC";				  $db->query($sql);				  while($db->next_record()) {					 $systemId = $db->f("systemId");					 $sql = "SELECT * FROM gamecms_newsSystemLink WHERE newsId='".$_POST['newsId']."' AND systemId='$systemId'";					 $db2->query($sql);					 if ($db2->next_record()) {						 ?>						 <option value="<?php echo $systemId; ?>" selected="selected" /><?php echo $db->f("systemName"); ?>						 <?					 } else {						 ?>						 <option value="<?php echo $systemId; ?>" /><?php echo $db->f("systemName"); ?>						 <?					 }					 $i++;				  }				  ?>				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">Related Games<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>				<td class="right">				 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">				  <?				  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";				  $db->query($sql);				  $i=0;				  while($db->next_record()) {					 $systemId = $db->f("systemId");					 $gameId = $db->f("gameId");					 $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";					 $db2->query($sql);					 $db2->next_record();					 $systemAbbrev = $db2->f("systemAbbrev");					 $sql = "SELECT * FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."' AND gameId='$gameId'";					 $db2->query($sql);					 if ($db2->next_record()) {						 ?>						 <option value="<?php echo $gameId; ?>" selected="selected" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>						 <?					 } else {						 ?>						 <option value="<?php echo $gameId; ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>						 <?					 }					 $i++;				  }				  ?>				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">S<u>h</u>ort News<font color="#DE7900">*</font>:</td>				<td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $shortNews; ?></textarea></td>			   </tr>			   <tr>				<td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>				<td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $longNews; ?></textarea></td>			   </tr>			   <tr>				<td class="left" align="right">Icon:</td>				<td class="right">				 <select class="select" id="iconId" name="iconId">				  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --				  <?				  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";				  $db->query($sql);				  while($db->next_record()) {					  $imageId = $db->f("imageId");					  ?>					  <option value="<?php echo $imageId; ?>" <?php if ($imageId == $iconId) { echo "selected=\"selected\""; } ?>
Link to comment
Share on other sites

It might just be that you left off the </option> tags for your select options. Also, you might find a function like this handy:

function str_crop($str, $len){  return (strlen($str) > $len ? substr($str, 0, $len - 3) . "..." : $str);}

print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");

Link to comment
Share on other sites

It might just be that you left off the </option> tags for your select options. Also, you might find a function like this handy:
function str_crop($str, $len){  return (strlen($str) > $len ? substr($str, 0, $len - 3) . "..." : $str);}

print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");

First of all I didnot make this code a friend made this for the cms I am usingAnd if this would have been the case
print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");

Then it should also not show the news because IT also has the same /> in the end and not </option> in the end but I will try it

Link to comment
Share on other sites

Strange I just am using the stock code again and Am getting this error Parse error: syntax error, unexpected T_DEC in D:\xampp\htdocs\xtranet\comments\index.php on line 511Last few lines of the index.php

			   <tr>				<td class="left" align="right" valign="top">Related Games<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>				<td class="right">				 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">				  <?				  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";				  $db->query($sql);				  $i=0;				  while($db->next_record()) {					 $systemId = $db->f("systemId");					 $gameId = $db->f("gameId");					 $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";					 $db2->query($sql);					 $db2->next_record();					 $systemAbbrev = $db2->f("systemAbbrev");					 $sql = "SELECT * FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."' AND gameId='$gameId'";					 $db2->query($sql);					 if ($db2->next_record()) {						 ?>						 <option value="<?php echo $gameId; ?>" selected="selected" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>						 <?					 } else {						 ?>						 <option value="<?php echo $gameId; ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>						 <?					 }					 $i++;				  }				  ?>				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right" valign="top">S<u>h</u>ort News<font color="#DE7900">*</font>:</td>				<td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $shortNews; ?></textarea></td>			   </tr>			   <tr>				<td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>				<td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $longNews; ?></textarea></td>			   </tr>			   <tr>				<td class="left" align="right">Icon:</td>				<td class="right">				 <select class="select" id="iconId" name="iconId">				  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --				  <?				  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";				  $db->query($sql);				  while($db->next_record()) {					  $imageId = $db->f("imageId");					  ?>					  <option value="<?php echo $imageId; ?>" <?php if ($imageId == $iconId) { echo "selected=\"selected\""; } ?> /><?php echo $db->f("comment"); ?>					  <?				  }				  ?>				  <option value="0" style="background-color: #D5E9FF;" />-- Choose Icon --				 </select>				</td>			   </tr>			   <tr>				<td class="left" align="right">S<u>o</u>urce:</td>				<td class="right"><input class="input" type="text" id="source" name="source" value="<?php echo $source; ?>" maxlength="255" accesskey="o" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right"><u>S</u>ource Link:</td>				<td class="right"><input class="input" type="text" id="sourceLink" name="sourceLink" value="<?php echo $sourceLink; ?>" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td class="left" align="right"><u>F</u>orum Link:</td>				<td class="right"><input class="input" type="text" id="forumLink" name="forumLink" value="<?php echo $forumLink; ?>" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>			   </tr>			   <tr>				<td> </td>				<td valign="middle" class="right">				 <button onClick="return validateEditForm();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button>				</td>			   </tr>			   <?php		   } else {			   ?>			   <input type="hidden" name="operation" value="edit" />			   <input type="hidden" name="stage" value="2" />			   <tr>				<td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>				<td class="right">				 <select id="newsId" name="newsId" class="select">				  <?				  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";				  $db->query($sql);				  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  while ($db->next_record()) {					  $id = $db->f("newsId");					  $subject = stripslashes($db->f("subject"));					  print("<option value=$id>$subject\n");				  }				  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  ?>				 </select>				</td>			   </tr>			   <tr>				<td> </td>				<td valign="middle" class="right">				 <button onClick="return validateChooseNews();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button><br /><br />				</td>			   </tr>			   <?php		   }	   } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {		   if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {			   $sql = "UPDATE gamecms_comment SET deleted = '1' WHERE commentId='".$_POST['commentId']."'";			   $db->query($sql);			   printf("<tr><td class=\"text\"><br /><br />Thanks for your delete.<br /><hr /></td></tr>");			   printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");		   } else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {			   ?>			   <input type="hidden" name="operation" value="delete" />			   <input type="hidden" name="stage" value="3" />			   <input type="hidden" name="newsId" value="<?php echo $newsId; ?>" />			   <input type="hidden" name="commentId" value="<?php echo $commentId; ?>" />			   <tr>				<td>Choose Comment<font color="#DE7900">*</font>:</td>				<td align="left">				 <select id="commentId" name="commentId" class="select">				  <?				  $sql = "SELECT commentId, comment, userName FROM gamecms_comment WHERE assetId = '$newsId' AND section ='news' AND deleted='0' ORDER BY timestamp DESC";				  $db->query($sql);				  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose Comment --");				  while ($db->next_record()) {					  $id = $db->f("commentId");					  $comment = stripslashes($db->f("comment"));					  $userName = stripslashes($db->f("userName"));					  print("<option value=$id>$userName - $comment\n");				  }				  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  ?>				 </select>				</td>			   </tr>				<td valign="middle" class="right">				 <button onClick="return confirmDelete();" accesskey="d" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>D</u>elete News</button>				</td>			   </tr>			   <?php		   } else {			   ?>			   <input type="hidden" name="operation" value="delete" />			   <input type="hidden" name="stage" value="2" />			   <tr>				<td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>				<td class="right">				 <select id="newsId" name="newsId" class="select">				  <?				  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";				  $db->query($sql);				  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  while ($db->next_record()) {					  $id = $db->f("newsId");					  $subject = stripslashes($db->f("subject"));					  print("<option value=$id>$subject\n");				  }				  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  ?>				 </select>				</td>			   </tr>			   <tr>				<td> </td>				<td valign="middle" class="right">				 <button onClick="return validateChooseNews();" accesskey="d" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>D</u>elete News</button><br /><br />				</td>			   </tr>			   <?php		   }	   }	   ?>	   <tr>		<td style="height: 15px;"></td>	   </tr>	  </table>	 </form>	</td>	<td width="4px" style="background-image: url(../images/formContentRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr style="height: 4px;">	<td width="4" align="right" style="background-image: url(../images/formFooterLeft.gif); background-repeat: repeat-y;"></td>	<td width="800" style="background-image: url(../images/formFooterStretch.gif); background-repeat: repeat-x;"></td>	<td width="4" style="background-image: url(../images/formFooterRight.gif); background-repeat: repeat-y;"></td>   </tr>  </table>  <p style="text-align: left; font-size: 7pt; margin-top: 6px; margin-left: 370; font-family: Tahoma; color: #E2EDFF;">© Copyright 2005, gameCMS</p> </body></html>

Link to comment
Share on other sites

First of all I didnot make this code a friend made this for the cms I am using
It doesn't matter who wrote it, the errors are still there.
Then it should also not show the news because IT also has the same /> in the end and not </option> in the end but I will try it
I see the other options, like this one:<option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --It's not correct to do that. The option tag requires the displayed value to be inside the tag. When the tag ends with />, that means it is self-closing. Writing this:<option />is the same as this:<option></option>But option tags need the display value inside. The correct format for an option tag is like this:<option value="value">text</option>If the option tag self-closes then there's no place to write the text. Some browsers still might show it, but it's not correct to do it that way. I don't know if that's the reason why you aren't seeing things, but it should still be fixed at some point.
Strange I just am using the stock code again and Am getting this error Parse error: syntax error, unexpected T_DEC in D:\xampp\htdocs\xtranet\comments\index.php on line 511
Which line is 511?
Link to comment
Share on other sites

Alright I did as you said I replaced /> with <option / >and now the code looks likes this

else {			   ?>			   <input type="hidden" name="operation" value="edit" />			   <input type="hidden" name="stage" value="2" />			   <tr>				<td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>				<td class="right">				 <select id="newsId" name="newsId" class="select">				  <?				  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";				  $db->query($sql);				  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  while ($db->next_record()) {					  $id = $db->f("newsId");					  $subject = stripslashes($db->f("subject"));					  print("<option value=$id>$subject\n");				  }				  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  ?>				 </select>				</td>			   </tr>			   <tr>				<td> </td>				<td valign="middle" class="right">				 <button onClick="return validateChooseNews();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button><br /><br />				</td>			   </tr>			   <?php		   }	   } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {		   if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {			   $sql = "UPDATE gamecms_comment SET deleted = '1' WHERE commentId='".$_POST['commentId']."'";			   $db->query($sql);			   printf("<tr><td class=\"text\"><br /><br />Thanks for your delete.<br /><hr /></td></tr>");			   printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");		   } else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {			   ?>			   <input type="hidden" name="operation" value="delete" />			   <input type="hidden" name="stage" value="3" />			   <input type="hidden" name="newsId" value="<?php echo $newsId; ?>" />			   <input type="hidden" name="commentId" value="<?php echo $commentId; ?>" />			   <tr>				<td>Choose Comment<font color="#DE7900">*</font>:</td>				<td align="left">				 <select id="commentId" name="commentId" class="select">				  <?				  $sql = "SELECT commentId, comment, userName FROM gamecms_comment WHERE assetId = '$newsId' AND section ='news' AND deleted='0' ORDER BY timestamp DESC";				  $db->query($sql);				  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose Comment --");				  while ($db->next_record()) {					  $id = $db->f("commentId");					  $comment = stripslashes($db->f("comment"));					  $userName = stripslashes($db->f("userName"));function str_crop($str, $len){  return (strlen($str) > $len ? substr($str, 0, $len - 3) . "..." : $str);}					  print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");				  }				  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");				  ?>				 </select>				</td>			   </tr>

But still it shows the news and when I choose a news then it shows no comments although there are comments for that specific news in the database.I really am confused this is the full code

<?php/***************************************************************************** * gameCMS Lite - A Content Management System designed for gaming websites * Copyright © 2006-2007 [url="http://www.gamecms.com/"]http://www.gamecms.com/[/url] * * File    : news/index.php * Version : 1.1 * Author  : Greg "FireFly" Ellwood *****************************************************************************//***************************************************************************** *  This file is part of gameCMS Lite. * *  gameCMS Lite is free software; you can redistribute it and/or modify it *  under the terms of the GNU General Public License as published by the Free *  Software Foundation; either version 2 of the License, or (at your option) *  any later version. * *  gameCMS Lite is distributed in the hope that it will be useful, but *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *  for more details. * *  You should have received a copy of the GNU General Public License along *  with gameCMS Lite; if not, write to the Free Software Foundation, Inc., *  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *****************************************************************************/define('IN_GAMECMS', true);require_once '../php-bin/db_mysql.inc.php';$db = new DB_Sql();$db2 = new DB_Sql();require_once '../includes/functions.inc.php';require_once '../includes/checkuser.inc.php';if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {    $formName = 'DELETE COMMENTS';    $formDesc = 'Please use the form below to delete comments from your website or choose another link from the menu on the left.';}?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>  <title>gameCMS Lite</title>  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />  <link rel="stylesheet" type="text/css" href="../css/gamecms.css" />  <link rel="stylesheet" type="text/css" href="../css/calendar.css" />  <script src="../js/functions.js"></script>  <script language="javascript" type="text/javascript" src="../js/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script>  <script language="javascript" type="text/javascript"> tinyMCE.init({  mode : "textareas",  theme : "advanced",  plugins : "table,advhr,advimage,advlink,preview,flash,searchreplace,print,contextmenu,paste,fullscreen,noneditable",  theme_advanced_buttons1_add_before : "newdocument,separator",  theme_advanced_buttons1_add : "fontselect,fontsizeselect",  theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor",  theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",  theme_advanced_buttons3_add : "advhr,separator,print,separator,fullscreen",  theme_advanced_buttons3_add_before : "tablecontrols,separator",  theme_advanced_toolbar_location : "top",  theme_advanced_toolbar_align : "left",  theme_advanced_path_location : "bottom",  content_css : "/example_data/example_full.css",  extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",  theme_advanced_resize_horizontal : false,  theme_advanced_resizing : true });  </script>  <script type="text/javascript" src="../js/calendar.js"></script>  <script type="text/javascript" src="../js/calendar-en.js"></script>  <script type="text/javascript" src="../js/calendar-setup.js"></script>  <script language="JavaScript">  function validateChooseNews() {      if ((document.getElementById('newsId').options[document.getElementById('newsId').selectedIndex].value) == "0") {          alert("You must choose a News Article from the dropdown list!");          return false;      } else {          document.forms[0].submit();      }  }   function setNewsId(id) {      document.getElementById('newsId').value = id;  }  function confirmDelete()  {      var agree = confirm("Are you sure you wish to delete this comment?");      if (agree) {          document.forms[0].submit();      } else {          return false;      }  }  function show(obj) {      document.getElementById(obj).style.display = '';  }  function hide(obj) {      document.getElementById(obj).style.display = 'none';  }  </script> </head> <body bgcolor="#475D82" style="margin: 0px;"<?php if ((isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'add') && !(isset($_REQUEST['stage']))) {?>onload="newsCategoryId.focus()"<?php } ?>>  <table width="808" cellspacing="0" cellpadding="0" style="margin-left: 6px;">   <tr style="height: 28px;">    <td width="7" align="right"><img src="../images/formTitleLeft.gif" alt="" /></td>    <td width="794" style="background-image: url(../images/formTitleStretch.gif); background-repeat: repeat-x; text-align: left; font-size: 7pt; font-family: Tahoma; color: #424242;"><span style="position: relative; top: 8px; left: 5px;"><strong><?php echo $formName; ?></strong></span><span style="float: right; position: relative; top: -5px; left: -5px;"><a href="#" onClick="popup('../help/nohelp.htm', 450, 300);"><img src="../images/help.gif" alt="" border="0" /></a></span></td>    <td width="7"><img src="../images/formTitleRight.gif" alt="" /></td>   </tr>  </table>  <table cellspacing="0" cellpadding="0" style="margin-left: 6px;">   <tr style="height: 65px;">    <td width="4" align="right" style="background-image: url(../images/formHeaderLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" bgcolor="#B0C6DE">     <table width="100%" cellspacing="0" cellpadding="0">      <tr>       <td width="80"><img src="../images/siteLogo.gif" width="132" height="65" alt="" /></td>       <td width="20"> </td>       <td style="font-family: Tahoma; color: #000000; font-size: 8pt;"><i><?php echo $formDesc; ?></i></td>      </tr>     </table>    </td>    <td width="4" style="background-image: url(../images/formHeaderRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr style="height: 2px;">    <td width="4" align="right" style="background-image: url(../images/formDividerLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" style="background-image: url(../images/formDividerStretch.gif); background-repeat: repeat-x;"></td>    <td width="4" style="background-image: url(../images/formDividerRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr>    <td width="4" align="right" style="background-image: url(../images/formContentLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" bgcolor="#C1D2E6" align="center">     <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">      <table width="730" cellspacing="0" cellpadding="0">       <tr>        <td style="height: 15px;"></td>       </tr>       <?php       if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'add') {           if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {               $timestamp = date("Y-m-d G:i:s");               //if ($releaseDateTime == "") {                 $releaseDateTime = $timestamp;               //}               $newsCategoryId = $_POST['newsCategoryId'];               if ($newsCategoryId == -2) {                  $sql = "INSERT INTO gamecms_newsCategory values ('', '".safeEscapeString($_POST['newCategory'])."','$userId','0')";                  $db->query($sql);                  $sql = "SELECT newsCategoryId FROM gamecms_newsCategory WHERE newsCategory='".$_POST['newCategory']."' AND deleted='0'";                  $db->query($sql);                  $db->next_record();                  $newsCategoryId = $db->f("newsCategoryId");               }               $sql = "INSERT INTO gamecms_news values ('','$userId','".$newsCategoryId."','".safeEscapeString($_POST['subject'])."','".$_POST['shortNews']."','".$_POST['longNews']."','".$_POST['iconId']."','".$_POST['source']."','".$_POST['sourceLink']."','".$_POST['forumLink']."','$releaseDateTime','$timestamp','1','0')";               $db->query($sql);               $sql = "SELECT newsId FROM gamecms_news WHERE subject='".safeEscapeString($_POST['subject'])."' AND timestamp='$timestamp'";               $db->query($sql);               $db->next_record();               $newsId = $db->f("newsId");               $systems = $_POST['systems'];               $numElements = count($systems);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsSystemLink values ('', '$newsId','$systems[$i]')";                  $db->query($sql);               }               $games = $_POST['games'];               $numElements = count($games);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsGameLink values ('', '$newsId','$games[$i]')";                  $db->query($sql);               }               printf("<tr><td class=\"text\"><br /><br />Thanks for your news post.<br /><hr /></td></tr>");               printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");           } else {               ?>               <input type="hidden" name="operation" value="add" />               <input type="hidden" name="stage" value="2" />               <tr>                <td class="left" align="right">News Category<font color="#DE7900">*</font>:</td>                <td class="right">                 <select class="select" id="newsCategoryId" name="newsCategoryId" onChange="if (this.value == '-2') { show('newCategoryRow'); } else { hide('newCategoryRow') }">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Category --                  <option value="-2" style="background-color: #D5E9FF;" />New                  <option value="-1" style="background-color: #D5E9FF;" />None                  <?                  $sql = "SELECT * FROM gamecms_newsCategory WHERE newsCategoryId > '0' AND deleted='0' ORDER BY newsCategory ASC";                  $db->query($sql);                  while($db->next_record()) {                 ?>                 <option value="<?php echo $db->f("newsCategoryId"); ?>" /><?php echo $db->f("newsCategory"); ?>                 <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Category --                 </select>                </td>               </tr>               <tr id="newCategoryRow" style="display: none;">                <td class="left" align="right">New Category:</td>                <td class="right"><input class="input" type="text" id="newCategory" name="newCategory" maxlength="30" value="" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ubject<font color="#DE7900">*</font>:</td>                <td class="right"><input class="input" type="text" id="subject" name="subject" value="" maxlength="255" accesskey="s" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Systems<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="systems[]" name="systems[]" multiple="multiple" style="height: 110px;">                  <?                  $sql = "SELECT * FROM gamecms_system WHERE deleted='0' ORDER BY systemName ASC";                  $db->query($sql);                  while($db->next_record()) {                 ?>                 <option value="<?php echo $db->f("systemId"); ?>" /><?php echo $db->f("systemName"); ?>                 <?                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Games:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">                  <?                  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";                  $db->query($sql);                  while($db->next_record()) {                     $systemId = $db->f("systemId");                     $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";                     $db2->query($sql);                     $db2->next_record();                     $systemAbbrev = $db2->f("systemAbbrev");                     ?>                 <option value="<?php echo $db->f("gameId"); ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>                 <?                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">S<u>h</u>ort News:</td>                <td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"></textarea></td>               </tr>               <tr>                <td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>                <td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"></textarea></td>               </tr>               <tr>                <td class="left" align="right">Icon:</td>                <td class="right">                 <select class="select" id="iconId" name="iconId">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --                  <?                  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";                  $db->query($sql);                  while($db->next_record()) {                 ?>                 <option value="<?php echo $db->f("imageId"); ?>" /><?php echo $db->f("comment"); ?>                 <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Icon --                 </select>                </td>               </tr>               <tr>                <td class="left" align="right">S<u>o</u>urce:</td>                <td class="right"><input class="input" type="text" id="source" name="source" value="" maxlength="255" accesskey="o" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ource Link:</td>                <td class="right"><input class="input" type="text" id="sourceLink" name="sourceLink" value="" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>F</u>orum Link:</td>                <td class="right"><input class="input" type="text" id="forumLink" name="forumLink" value="" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateAddForm();" accesskey="a" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>A</u>dd News</button>                </td>               </tr>               <?php           }       } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'edit') {           if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {               $sql = "UPDATE gamecms_news SET newsCategoryId='".$_POST['newsCategoryId']."',subject='".safeEscapeString($_POST['subject'])."',shortNews='".$_POST['shortNews']."',longNews='".$_POST['longNews']."',iconId='".$_POST['iconId']."',source='".$_POST['source']."',sourceLink='".$_POST['sourceLink']."',forumLink='".$_POST['forumLink']."' WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $sql = "DELETE FROM gamecms_newsSystemLink WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $systems = $_POST['systems'];               $numElements = count($systems);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsSystemLink values ('', '".$_POST['newsId']."','$systems[$i]')";                  $db->query($sql);               }               $sql = "DELETE FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $games = $_POST['games'];               $numElements = count($games);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsGameLink values ('', '".$_POST['newsId']."','$games[$i]')";                  $db->query($sql);               }               printf("<tr><td class=\"text\"><br /><br />Thanks for your edit.<br /><hr /></td></tr>");               printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");            } else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {               $sql = "SELECT * FROM gamecms_news WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $db->next_record();               $newsCategoryId = $db->f("newsCategoryId");               $subject = $db->f("subject");               $shortNews = $db->f("shortNews");               $longNews = $db->f("longNews");               $iconId = $db->f("iconId");               $source = $db->f("source");               $sourceLink = $db->f("sourceLink");               $forumLink = $db->f("forumLink");               $releaseDateTime = $db->f("releaseDateTime");               ?>               <input type="hidden" name="operation" value="edit" />               <input type="hidden" name="stage" value="3" />               <input type="hidden" name="newsId" value="<?php echo $_POST['newsId']; ?>" />               <tr>                <td class="left" align="right">News Category<font color="#DE7900">*</font>:</td>                <td class="right">                 <select class="select" id="newsCategoryId" name="newsCategoryId">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Category --                  <option value="-1" style="background-color: #D5E9FF;" />None                  <?                  $sql = "SELECT * FROM gamecms_newsCategory WHERE newsCategoryId > '0' AND deleted='0' ORDER BY newsCategory ASC";                  $db->query($sql);                  while($db->next_record()) {                      $id = $db->f("newsCategoryId");                      ?>                      <option value="<?php echo $id; ?>" <?php If ($id == $newsCategoryId) { echo "selected=\"selected\""; } ?> /><?php echo $db->f("newsCategory"); ?>                      <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Category --                 </select>                </td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ubject<font color="#DE7900">*</font>:</td>                <td class="right"><input class="input" type="text" id="subject" name="subject" value="<?php echo $subject; ?>" maxlength="255" accesskey="s" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Systems<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="systems[]" name="systems[]" multiple="multiple" style="height: 120px;">                  <?                  $sql = "SELECT * FROM gamecms_system WHERE deleted='0' ORDER BY systemName ASC";                  $db->query($sql);                  while($db->next_record()) {                     $systemId = $db->f("systemId");                     $sql = "SELECT * FROM gamecms_newsSystemLink WHERE newsId='".$_POST['newsId']."' AND systemId='$systemId'";                     $db2->query($sql);                     if ($db2->next_record()) {                         ?>                         <option value="<?php echo $systemId; ?>" selected="selected" /><?php echo $db->f("systemName"); ?>                         <?                     } else {                         ?>                         <option value="<?php echo $systemId; ?>" /><?php echo $db->f("systemName"); ?>                         <?                     }                     $i++;                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Games<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">                  <?                  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";                  $db->query($sql);                  $i=0;                  while($db->next_record()) {                     $systemId = $db->f("systemId");                     $gameId = $db->f("gameId");                     $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";                     $db2->query($sql);                     $db2->next_record();                     $systemAbbrev = $db2->f("systemAbbrev");                     $sql = "SELECT * FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."' AND gameId='$gameId'";                     $db2->query($sql);                     if ($db2->next_record()) {                         ?>                         <option value="<?php echo $gameId; ?>" selected="selected" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>                         <?                     } else {                         ?>                         <option value="<?php echo $gameId; ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?>                         <?                     }                     $i++;                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">S<u>h</u>ort News<font color="#DE7900">*</font>:</td>                <td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $shortNews; ?></textarea></td>               </tr>               <tr>                <td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>                <td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $longNews; ?></textarea></td>               </tr>               <tr>                <td class="left" align="right">Icon:</td>                <td class="right">                 <select class="select" id="iconId" name="iconId">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --                  <?                  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";                  $db->query($sql);                  while($db->next_record()) {                      $imageId = $db->f("imageId");                      ?>                      <option value="<?php echo $imageId; ?>" <?php if ($imageId == $iconId) { echo "selected=\"selected\""; } ?> /><?php echo $db->f("comment"); ?>                      <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Icon --                 </select>                </td>               </tr>               <tr>                <td class="left" align="right">S<u>o</u>urce:</td>                <td class="right"><input class="input" type="text" id="source" name="source" value="<?php echo $source; ?>" maxlength="255" accesskey="o" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ource Link:</td>                <td class="right"><input class="input" type="text" id="sourceLink" name="sourceLink" value="<?php echo $sourceLink; ?>" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>F</u>orum Link:</td>                <td class="right"><input class="input" type="text" id="forumLink" name="forumLink" value="<?php echo $forumLink; ?>" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateEditForm();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button>                </td>               </tr>               <?php           } else {               ?>               <input type="hidden" name="operation" value="edit" />               <input type="hidden" name="stage" value="2" />               <tr>                <td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>                <td class="right">                 <select id="newsId" name="newsId" class="select">                  <?                  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";                  $db->query($sql);                  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --");                  while ($db->next_record()) {                      $id = $db->f("newsId");                      $subject = stripslashes($db->f("subject"));                      print("<option value=$id>$subject\n");                  }                  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");                  ?>                 </select>                </td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateChooseNews();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button><br /><br />                </td>               </tr>               <?php           }       } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {           if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {               $sql = "UPDATE gamecms_comment SET deleted = '1' WHERE commentId='".$_POST['commentId']."'";               $db->query($sql);               printf("<tr><td class=\"text\"><br /><br />Thanks for your delete.<br /><hr /></td></tr>");               printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");           } else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {               ?>               <input type="hidden" name="operation" value="delete" />               <input type="hidden" name="stage" value="3" />               <input type="hidden" name="newsId" value="<?php echo $newsId; ?>" />               <input type="hidden" name="commentId" value="<?php echo $commentId; ?>" />               <tr>                <td>Choose Comment<font color="#DE7900">*</font>:</td>                <td align="left">                 <select id="commentId" name="commentId" class="select">                  <?                  $sql = "SELECT commentId, comment, userName FROM gamecms_comment WHERE assetId = '$newsId' AND section ='news' AND deleted='0' ORDER BY timestamp DESC";                  $db->query($sql);                  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose Comment --");                  while ($db->next_record()) {                      $id = $db->f("commentId");                      $comment = stripslashes($db->f("comment"));					  $userName = stripslashes($db->f("userName"));function str_crop($str, $len){  return (strlen($str) > $len ? substr($str, 0, $len - 3) . "..." : $str);}                      print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");                  }                  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");                  ?>                 </select>                </td>               </tr>                <td valign="middle" class="right">                 <button onClick="return confirmDelete();" accesskey="d" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>D</u>elete News</button>                </td>               </tr>               <?php           } else {               ?>               <input type="hidden" name="operation" value="delete" />               <input type="hidden" name="stage" value="2" />               <tr>                <td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>                <td class="right">                 <select id="newsId" name="newsId" class="select">                  <?                  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";                  $db->query($sql);                  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --");                  while ($db->next_record()) {                      $id = $db->f("newsId");                      $subject = stripslashes($db->f("subject"));                      print("<option value=$id>$subject\n");                  }                  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");                  ?>                 </select>                </td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateChooseNews();" accesskey="d" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>D</u>elete News</button><br /><br />                </td>               </tr>               <?php           }       }       ?>       <tr>        <td style="height: 15px;"></td>       </tr>      </table>     </form>    </td>    <td width="4px" style="background-image: url(../images/formContentRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr style="height: 4px;">    <td width="4" align="right" style="background-image: url(../images/formFooterLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" style="background-image: url(../images/formFooterStretch.gif); background-repeat: repeat-x;"></td>    <td width="4" style="background-image: url(../images/formFooterRight.gif); background-repeat: repeat-y;"></td>   </tr>  </table>  <p style="text-align: left; font-size: 7pt; margin-top: 6px; margin-left: 370; font-family: Tahoma; color: #E2EDFF;">© Copyright 2005, gameCMS</p> </body></html>

Thanks for helping me,

Link to comment
Share on other sites

There are still a few that don't have the closing tag on them, things like this:print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --");should be like this:print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");Search through the code for "<option" and make sure that each one ends properly. You should also be able to view the source of the HTML page and check the select boxes to see if it is writing out the options and the browser just isn't displaying them.Also, take the str_crop function definition out of the while loop, move that to the top or bottom of the file. Also add this on the top to make sure error messages are being printed:ini_set("display_errors", 1);error_reporting(E_ALL);You can also print out the $sql variable and paste the query directly into phpMyAdmin to make sure it's returning records.

Link to comment
Share on other sites

Alright added </option> at the end of each option tagthis is HTML source code that I checked while choosing a comment ( still there wasnt any )

<i>Please use the form below to delete comments from your website or choose another link from the menu on the left.</i></td>	  </tr>	 </tbody></table>	</td>	<td style="background-image: url(../images/formHeaderRight.gif); background-repeat: repeat-y;" width="4"></td>   </tr>   <tr style="height: 2px;">	<td style="background-image: url(../images/formDividerLeft.gif); background-repeat: repeat-y;" align="right" width="4"></td>	<td style="background-image: url(../images/formDividerStretch.gif); background-repeat: repeat-x;" width="800"></td>	<td style="background-image: url(../images/formDividerRight.gif); background-repeat: repeat-y;" width="4"></td>   </tr>   <tr>	<td style="background-image: url(../images/formContentLeft.gif); background-repeat: repeat-y;" align="right" width="4"></td>	<td align="center" bgcolor="#c1d2e6" width="800">	 <form method="post" action="/xtranet/comments/index.php">	  <input name="operation" value="delete" type="hidden">			   <input name="stage" value="3" type="hidden">			   <input name="newsId" value="" type="hidden">			   <input name="commentId" value="" type="hidden">			   <table cellpadding="0" cellspacing="0" width="730">	   <tbody><tr>		<td style="height: 15px;"></td>	   </tr>					  <tr>				<td>Choose Comment<font color="#de7900">*</font>:</td>				<td align="left">				 <select id="commentId" name="commentId" class="select">				  <option value="0" selected="selected" style="background-color: rgb(213, 233, 255);">-- Choose Comment --</option><option value="0" style="background-color: rgb(213, 233, 255);">-- Choose News --</option>				 </select>				</td>			   </tr>				<tr><td class="right" valign="middle">				 <button onclick="return confirmDelete();" accesskey="d" onmouseover="this.className = 'buttonmouseover'" onmouseout="this.className = 'buttonmouseout'"><u>D</u>elete News</button>				</td>			   </tr>					  <tr>		<td style="height: 15px;"></td>	   </tr>	  </tbody></table>	 </form>	</td>	<td style="background-image: url(../images/formContentRight.gif); background-repeat: repeat-y;" width="4"></td>   </tr>   <tr style="height: 4px;">	<td style="background-image: url(../images/formFooterLeft.gif); background-repeat: repeat-y;" align="right" width="4"></td>	<td style="background-image: url(../images/formFooterStretch.gif); background-repeat: repeat-x;" width="800"></td>	<td style="background-image: url(../images/formFooterRight.gif); background-repeat: repeat-y;" width="4"></td>   </tr>  </tbody></table>  <p style="text-align: left; font-size: 7pt; margin-top: 6px; margin-left: 370px; font-family: Tahoma; color: rgb(226, 237, 255);">© Copyright 2005, gameCMS</p>

and now this is the full code with </option> tags :)

<?php/***************************************************************************** * gameCMS Lite - A Content Management System designed for gaming websites * Copyright © 2006-2007 [url="http://www.gamecms.com/"]http://www.gamecms.com/[/url] * * File    : news/index.php * Version : 1.1 * Author  : Greg "FireFly" Ellwood *****************************************************************************//***************************************************************************** *  This file is part of gameCMS Lite. * *  gameCMS Lite is free software; you can redistribute it and/or modify it *  under the terms of the GNU General Public License as published by the Free *  Software Foundation; either version 2 of the License, or (at your option) *  any later version. * *  gameCMS Lite is distributed in the hope that it will be useful, but *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *  for more details. * *  You should have received a copy of the GNU General Public License along *  with gameCMS Lite; if not, write to the Free Software Foundation, Inc., *  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *****************************************************************************/define('IN_GAMECMS', true);require_once '../php-bin/db_mysql.inc.php';$db = new DB_Sql();$db2 = new DB_Sql();require_once '../includes/functions.inc.php';require_once '../includes/checkuser.inc.php';function str_crop($str, $len){  return (strlen($str) > $len ? substr($str, 0, $len - 3) . "..." : $str);}if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {    $formName = 'DELETE COMMENTS';    $formDesc = 'Please use the form below to delete comments from your website or choose another link from the menu on the left.';}?><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>  <title>gameCMS Lite</title>  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />  <link rel="stylesheet" type="text/css" href="../css/gamecms.css" />  <link rel="stylesheet" type="text/css" href="../css/calendar.css" />  <script src="../js/functions.js"></script>  <script language="javascript" type="text/javascript" src="../js/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script>  <script language="javascript" type="text/javascript"> tinyMCE.init({  mode : "textareas",  theme : "advanced",  plugins : "table,advhr,advimage,advlink,preview,flash,searchreplace,print,contextmenu,paste,fullscreen,noneditable",  theme_advanced_buttons1_add_before : "newdocument,separator",  theme_advanced_buttons1_add : "fontselect,fontsizeselect",  theme_advanced_buttons2_add : "separator,preview,separator,forecolor,backcolor",  theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",  theme_advanced_buttons3_add : "advhr,separator,print,separator,fullscreen",  theme_advanced_buttons3_add_before : "tablecontrols,separator",  theme_advanced_toolbar_location : "top",  theme_advanced_toolbar_align : "left",  theme_advanced_path_location : "bottom",  content_css : "/example_data/example_full.css",  extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",  theme_advanced_resize_horizontal : false,  theme_advanced_resizing : true });  </script>  <script type="text/javascript" src="../js/calendar.js"></script>  <script type="text/javascript" src="../js/calendar-en.js"></script>  <script type="text/javascript" src="../js/calendar-setup.js"></script>  <script language="JavaScript">  function validateChooseNews() {      if ((document.getElementById('newsId').options[document.getElementById('newsId').selectedIndex].value) == "0") {          alert("You must choose a News Article from the dropdown list!");          return false;      } else {          document.forms[0].submit();      }  }   function setNewsId(id) {      document.getElementById('newsId').value = id;  }  function confirmDelete()  {      var agree = confirm("Are you sure you wish to delete this comment?");      if (agree) {          document.forms[0].submit();      } else {          return false;      }  }  function show(obj) {      document.getElementById(obj).style.display = '';  }  function hide(obj) {      document.getElementById(obj).style.display = 'none';  }  </script> </head> <body bgcolor="#475D82" style="margin: 0px;"<?php if ((isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'add') && !(isset($_REQUEST['stage']))) {?>onload="newsCategoryId.focus()"<?php } ?>>  <table width="808" cellspacing="0" cellpadding="0" style="margin-left: 6px;">   <tr style="height: 28px;">    <td width="7" align="right"><img src="../images/formTitleLeft.gif" alt="" /></td>    <td width="794" style="background-image: url(../images/formTitleStretch.gif); background-repeat: repeat-x; text-align: left; font-size: 7pt; font-family: Tahoma; color: #424242;"><span style="position: relative; top: 8px; left: 5px;"><strong><?php echo $formName; ?></strong></span><span style="float: right; position: relative; top: -5px; left: -5px;"><a href="#" onClick="popup('../help/nohelp.htm', 450, 300);"><img src="../images/help.gif" alt="" border="0" /></a></span></td>    <td width="7"><img src="../images/formTitleRight.gif" alt="" /></td>   </tr>  </table>  <table cellspacing="0" cellpadding="0" style="margin-left: 6px;">   <tr style="height: 65px;">    <td width="4" align="right" style="background-image: url(../images/formHeaderLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" bgcolor="#B0C6DE">     <table width="100%" cellspacing="0" cellpadding="0">      <tr>       <td width="80"><img src="../images/siteLogo.gif" width="132" height="65" alt="" /></td>       <td width="20"> </td>       <td style="font-family: Tahoma; color: #000000; font-size: 8pt;"><i><?php echo $formDesc; ?></i></td>      </tr>     </table>    </td>    <td width="4" style="background-image: url(../images/formHeaderRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr style="height: 2px;">    <td width="4" align="right" style="background-image: url(../images/formDividerLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" style="background-image: url(../images/formDividerStretch.gif); background-repeat: repeat-x;"></td>    <td width="4" style="background-image: url(../images/formDividerRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr>    <td width="4" align="right" style="background-image: url(../images/formContentLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" bgcolor="#C1D2E6" align="center">     <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">      <table width="730" cellspacing="0" cellpadding="0">       <tr>        <td style="height: 15px;"></td>       </tr>       <?php       if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'add') {           if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {               $timestamp = date("Y-m-d G:i:s");               //if ($releaseDateTime == "") {                 $releaseDateTime = $timestamp;               //}               $newsCategoryId = $_POST['newsCategoryId'];               if ($newsCategoryId == -2) {                  $sql = "INSERT INTO gamecms_newsCategory values ('', '".safeEscapeString($_POST['newCategory'])."','$userId','0')";                  $db->query($sql);                  $sql = "SELECT newsCategoryId FROM gamecms_newsCategory WHERE newsCategory='".$_POST['newCategory']."' AND deleted='0'";                  $db->query($sql);                  $db->next_record();                  $newsCategoryId = $db->f("newsCategoryId");               }               $sql = "INSERT INTO gamecms_news values ('','$userId','".$newsCategoryId."','".safeEscapeString($_POST['subject'])."','".$_POST['shortNews']."','".$_POST['longNews']."','".$_POST['iconId']."','".$_POST['source']."','".$_POST['sourceLink']."','".$_POST['forumLink']."','$releaseDateTime','$timestamp','1','0')";               $db->query($sql);               $sql = "SELECT newsId FROM gamecms_news WHERE subject='".safeEscapeString($_POST['subject'])."' AND timestamp='$timestamp'";               $db->query($sql);               $db->next_record();               $newsId = $db->f("newsId");               $systems = $_POST['systems'];               $numElements = count($systems);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsSystemLink values ('', '$newsId','$systems[$i]')";                  $db->query($sql);               }               $games = $_POST['games'];               $numElements = count($games);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsGameLink values ('', '$newsId','$games[$i]')";                  $db->query($sql);               }               printf("<tr><td class=\"text\"><br /><br />Thanks for your news post.<br /><hr /></td></tr>");               printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");           } else {               ?>               <input type="hidden" name="operation" value="add" />               <input type="hidden" name="stage" value="2" />               <tr>                <td class="left" align="right">News Category<font color="#DE7900">*</font>:</td>                <td class="right">                 <select class="select" id="newsCategoryId" name="newsCategoryId" onChange="if (this.value == '-2') { show('newCategoryRow'); } else { hide('newCategoryRow') }">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Category --</option>                  <option value="-2" style="background-color: #D5E9FF;" />New</option>                  <option value="-1" style="background-color: #D5E9FF;" />None</option>                  <?                  $sql = "SELECT * FROM gamecms_newsCategory WHERE newsCategoryId > '0' AND deleted='0' ORDER BY newsCategory ASC";                  $db->query($sql);                  while($db->next_record()) {                 ?>                 <option value="<?php echo $db->f("newsCategoryId"); ?>" /><?php echo $db->f("newsCategory"); ?></option>                 <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Category --</option>                 </select>                </td>               </tr>               <tr id="newCategoryRow" style="display: none;">                <td class="left" align="right">New Category:</td>                <td class="right"><input class="input" type="text" id="newCategory" name="newCategory" maxlength="30" value="" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ubject<font color="#DE7900">*</font>:</td>                <td class="right"><input class="input" type="text" id="subject" name="subject" value="" maxlength="255" accesskey="s" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Systems<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="systems[]" name="systems[]" multiple="multiple" style="height: 110px;">                  <?                  $sql = "SELECT * FROM gamecms_system WHERE deleted='0' ORDER BY systemName ASC";                  $db->query($sql);                  while($db->next_record()) {                 ?>                 <option value="<?php echo $db->f("systemId"); ?>" /><?php echo $db->f("systemName"); ?></option>                 <?                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Games:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">                  <?                  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";                  $db->query($sql);                  while($db->next_record()) {                     $systemId = $db->f("systemId");                     $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";                     $db2->query($sql);                     $db2->next_record();                     $systemAbbrev = $db2->f("systemAbbrev");                     ?>                 <option value="<?php echo $db->f("gameId"); ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?></option>                 <?                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">S<u>h</u>ort News:</td>                <td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"></textarea></td>               </tr>               <tr>                <td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>                <td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"></textarea></td>               </tr>               <tr>                <td class="left" align="right">Icon:</td>                <td class="right">                 <select class="select" id="iconId" name="iconId">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --</option>                  <?                  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";                  $db->query($sql);                  while($db->next_record()) {                 ?>                 <option value="<?php echo $db->f("imageId"); ?>" /><?php echo $db->f("comment"); ?></option>                 <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Icon --</option>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right">S<u>o</u>urce:</td>                <td class="right"><input class="input" type="text" id="source" name="source" value="" maxlength="255" accesskey="o" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ource Link:</td>                <td class="right"><input class="input" type="text" id="sourceLink" name="sourceLink" value="" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>F</u>orum Link:</td>                <td class="right"><input class="input" type="text" id="forumLink" name="forumLink" value="" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateAddForm();" accesskey="a" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>A</u>dd News</button>                </td>               </tr>               <?php           }       } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'edit') {           if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {               $sql = "UPDATE gamecms_news SET newsCategoryId='".$_POST['newsCategoryId']."',subject='".safeEscapeString($_POST['subject'])."',shortNews='".$_POST['shortNews']."',longNews='".$_POST['longNews']."',iconId='".$_POST['iconId']."',source='".$_POST['source']."',sourceLink='".$_POST['sourceLink']."',forumLink='".$_POST['forumLink']."' WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $sql = "DELETE FROM gamecms_newsSystemLink WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $systems = $_POST['systems'];               $numElements = count($systems);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsSystemLink values ('', '".$_POST['newsId']."','$systems[$i]')";                  $db->query($sql);               }               $sql = "DELETE FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $games = $_POST['games'];               $numElements = count($games);               for ($i = 0; $i < $numElements; ++$i) {                  $sql = "INSERT INTO gamecms_newsGameLink values ('', '".$_POST['newsId']."','$games[$i]')";                  $db->query($sql);               }               printf("<tr><td class=\"text\"><br /><br />Thanks for your edit.<br /><hr /></td></tr>");               printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");            } else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {               $sql = "SELECT * FROM gamecms_news WHERE newsId='".$_POST['newsId']."'";               $db->query($sql);               $db->next_record();               $newsCategoryId = $db->f("newsCategoryId");               $subject = $db->f("subject");               $shortNews = $db->f("shortNews");               $longNews = $db->f("longNews");               $iconId = $db->f("iconId");               $source = $db->f("source");               $sourceLink = $db->f("sourceLink");               $forumLink = $db->f("forumLink");               $releaseDateTime = $db->f("releaseDateTime");               ?>               <input type="hidden" name="operation" value="edit" />               <input type="hidden" name="stage" value="3" />               <input type="hidden" name="newsId" value="<?php echo $_POST['newsId']; ?>" />               <tr>                <td class="left" align="right">News Category<font color="#DE7900">*</font>:</td>                <td class="right">                 <select class="select" id="newsCategoryId" name="newsCategoryId">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Category --</option>                  <option value="-1" style="background-color: #D5E9FF;" />None</option>                  <?                  $sql = "SELECT * FROM gamecms_newsCategory WHERE newsCategoryId > '0' AND deleted='0' ORDER BY newsCategory ASC";                  $db->query($sql);                  while($db->next_record()) {                      $id = $db->f("newsCategoryId");                      ?>                      <option value="<?php echo $id; ?>" <?php If ($id == $newsCategoryId) { echo "selected=\"selected\""; } ?> /><?php echo $db->f("newsCategory"); ?></option>                      <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Category --</option>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ubject<font color="#DE7900">*</font>:</td>                <td class="right"><input class="input" type="text" id="subject" name="subject" value="<?php echo $subject; ?>" maxlength="255" accesskey="s" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Systems<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="systems[]" name="systems[]" multiple="multiple" style="height: 120px;">                  <?                  $sql = "SELECT * FROM gamecms_system WHERE deleted='0' ORDER BY systemName ASC";                  $db->query($sql);                  while($db->next_record()) {                     $systemId = $db->f("systemId");                     $sql = "SELECT * FROM gamecms_newsSystemLink WHERE newsId='".$_POST['newsId']."' AND systemId='$systemId'";                     $db2->query($sql);                     if ($db2->next_record()) {                         ?>                         <option value="<?php echo $systemId; ?>" selected="selected" /><?php echo $db->f("systemName"); ?></option>                         <?                     } else {                         ?>                         <option value="<?php echo $systemId; ?>" /><?php echo $db->f("systemName"); ?></option>                         <?                     }                     $i++;                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">Related Games<font color="#DE7900">*</font>:<br /><font size="-2">(Ctrl+click for more than one)</font></td>                <td class="right">                 <select class="select" id="games[]" name="games[]" multiple="multiple" style="height: 120px;">                  <?                  $sql = "SELECT * FROM gamecms_game WHERE deleted='0' ORDER BY gameName ASC";                  $db->query($sql);                  $i=0;                  while($db->next_record()) {                     $systemId = $db->f("systemId");                     $gameId = $db->f("gameId");                     $sql = "SELECT * FROM gamecms_system WHERE systemId='$systemId'";                     $db2->query($sql);                     $db2->next_record();                     $systemAbbrev = $db2->f("systemAbbrev");                     $sql = "SELECT * FROM gamecms_newsGameLink WHERE newsId='".$_POST['newsId']."' AND gameId='$gameId'";                     $db2->query($sql);                     if ($db2->next_record()) {                         ?>                         <option value="<?php echo $gameId; ?>" selected="selected" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?></option>                         <?                     } else {                         ?>                         <option value="<?php echo $gameId; ?>" /><?php echo $db->f("gameName")." - (".$systemAbbrev.")"; ?></option>                         <?                     }                     $i++;                  }                  ?>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right" valign="top">S<u>h</u>ort News<font color="#DE7900">*</font>:</td>                <td class="right"><textarea style="width: 500px; height: 175px;" id="shortNews" name="shortNews" accesskey="h" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $shortNews; ?></textarea></td>               </tr>               <tr>                <td class="left" align="right" valign="top"><u>L</u>ong News<font color="#DE7900">*</font>:</td>                <td class="right"><textarea style="width: 500px; height: 350px;" id="longNews" name="longNews" accesskey="l" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';"><?php echo $longNews; ?></textarea></td>               </tr>               <tr>                <td class="left" align="right">Icon:</td>                <td class="right">                 <select class="select" id="iconId" name="iconId">                  <option value="0" style="background-color: #D5E9FF;" selected="selected" />-- Choose Icon --</option>                  <?                  $sql = "SELECT * FROM gamecms_image WHERE imageType='News Icon' AND auth='1' ORDER BY comment ASC";                  $db->query($sql);                  while($db->next_record()) {                      $imageId = $db->f("imageId");                      ?>                      <option value="<?php echo $imageId; ?>" <?php if ($imageId == $iconId) { echo "selected=\"selected\""; } ?> /><?php echo $db->f("comment"); ?></option>                      <?                  }                  ?>                  <option value="0" style="background-color: #D5E9FF;" />-- Choose Icon --</option>                 </select>                </td>               </tr>               <tr>                <td class="left" align="right">S<u>o</u>urce:</td>                <td class="right"><input class="input" type="text" id="source" name="source" value="<?php echo $source; ?>" maxlength="255" accesskey="o" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>S</u>ource Link:</td>                <td class="right"><input class="input" type="text" id="sourceLink" name="sourceLink" value="<?php echo $sourceLink; ?>" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td class="left" align="right"><u>F</u>orum Link:</td>                <td class="right"><input class="input" type="text" id="forumLink" name="forumLink" value="<?php echo $forumLink; ?>" maxlength="255" accesskey="f" onFocus="this.style.border='1px dashed #395E87';" onBlur="this.style.border='1px solid #618DBF';" /></td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateEditForm();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button>                </td>               </tr>               <?php           } else {               ?>               <input type="hidden" name="operation" value="edit" />               <input type="hidden" name="stage" value="2" />               <tr>                <td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>                <td class="right">                 <select id="newsId" name="newsId" class="select">                  <?                  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";                  $db->query($sql);                  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");                  while ($db->next_record()) {                      $id = $db->f("newsId");                      $subject = stripslashes($db->f("subject"));                      print("<option value=$id>$subject\n></option>");                  }                  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");                  ?>                 </select>                </td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateChooseNews();" accesskey="e" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>E</u>dit News</button><br /><br />                </td>               </tr>               <?php           }       } else if (isset($_REQUEST['operation']) && $_REQUEST['operation'] == 'delete') {           if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '3') {               $sql = "UPDATE gamecms_comment SET deleted = '1' WHERE commentId='".$_POST['commentId']."'";               $db->query($sql);               printf("<tr><td class=\"text\"><br /><br />Thanks for your delete.<br /><hr /></td></tr>");               printf("<tr><td class=\"text\">Please click <a href=\"../main.php\" target=\"content\">here</a> to return to the main page or choose another link from the menu.<br /><br /></td></tr>");           } else if (isset($_REQUEST['stage']) && $_REQUEST['stage'] == '2') {               ?>               <input type="hidden" name="operation" value="delete" />               <input type="hidden" name="stage" value="3" />               <input type="hidden" name="newsId" value="<?php echo $newsId; ?>" />               <input type="hidden" name="commentId" value="<?php echo $commentId; ?>" />               <tr>                <td>Choose Comment<font color="#DE7900">*</font>:</td>                <td align="left">                 <select id="commentId" name="commentId" class="select">                  <?                  $sql = "SELECT commentId, comment, userName FROM gamecms_comment WHERE assetId = '$newsId' AND section ='news' AND deleted='0' ORDER BY timestamp DESC";                  $db->query($sql);                  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose Comment --</option>");                  while ($db->next_record()) {                      $id = $db->f("commentId");                      $comment = stripslashes($db->f("comment"));					  $userName = stripslashes($db->f("userName"));                      print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");                  }                  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");                  ?>                 </select>                </td>               </tr>                <td valign="middle" class="right">                 <button onClick="return confirmDelete();" accesskey="d" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>D</u>elete News</button>                </td>               </tr>               <?php           } else {               ?>               <input type="hidden" name="operation" value="delete" />               <input type="hidden" name="stage" value="2" />               <tr>                <td class="left" align="right">Choose News<font color="#DE7900">*</font>:</td>                <td class="right">                 <select id="newsId" name="newsId" class="select">                  <?                  $sql = "SELECT newsId, subject FROM gamecms_news WHERE deleted='0' ORDER BY timestamp DESC";                  $db->query($sql);                  print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");                  while ($db->next_record()) {                      $id = $db->f("newsId");                      $subject = stripslashes($db->f("subject"));                      print("<option value=$id>$subject\n></option>");                  }                  print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");                  ?>                 </select>                </td>               </tr>               <tr>                <td> </td>                <td valign="middle" class="right">                 <button onClick="return validateChooseNews();" accesskey="d" onMouseOver="this.className = 'buttonmouseover'" onMouseOut="this.className = 'buttonmouseout'"><u>D</u>elete News</button><br /><br />                </td>               </tr>               <?php           }       }       ?>       <tr>        <td style="height: 15px;"></td>       </tr>      </table>     </form>    </td>    <td width="4px" style="background-image: url(../images/formContentRight.gif); background-repeat: repeat-y;"></td>   </tr>   <tr style="height: 4px;">    <td width="4" align="right" style="background-image: url(../images/formFooterLeft.gif); background-repeat: repeat-y;"></td>    <td width="800" style="background-image: url(../images/formFooterStretch.gif); background-repeat: repeat-x;"></td>    <td width="4" style="background-image: url(../images/formFooterRight.gif); background-repeat: repeat-y;"></td>   </tr>  </table>  <p style="text-align: left; font-size: 7pt; margin-top: 6px; margin-left: 370; font-family: Tahoma; color: #E2EDFF;">© Copyright 2005, gameCMS</p> </body></html> =';

Finally now you will be able to solve the problem (hopefully ) because it is the only hindrance after which I will launch my website :)Thanks a lot for helping me,Best Regards,

Link to comment
Share on other sites

Sorry If I am getting a bit curious and inpatient but please I need to solve this problem and I need your help in doing so :)Thanks a lot for helping me all,You people are great especially justsomeguyBest Regard

Link to comment
Share on other sites

Some things are weird. The tags you posted have RGB colors for background color:<option value="0" selected="selected" style="background-color: rgb(213, 233, 255);">-- Choose Comment --</option><option value="0" style="background-color: rgb(213, 233, 255);">-- Choose News --</option>The loop in your code doesn't have that, I'm not even sure if I'm looking at the right place. If this is the code that writes out your options:

<?$sql = "SELECT commentId, comment, userName FROM gamecms_comment WHERE assetId = '$newsId' AND section ='news' AND deleted='0' ORDER BY timestamp DESC";$db->query($sql);print("<option value=\"0\" selected=\"selected\" style=\"background-color: #D5E9FF;\">-- Choose Comment --</option>");while ($db->next_record()) {$id = $db->f("commentId");$comment = stripslashes($db->f("comment"));$userName = stripslashes($db->f("userName"));print("<option value=\"$id\">$userName - " . str_crop($comment, 50) . "</option>");}print("<option value=\"0\" style=\"background-color: #D5E9FF;\">-- Choose News --</option>");?>

If it's not writing anything, then the query in $sql isn't returning any records. Print $sql out and run it on the database to make sure it actually returns records.Also, please use a codebox for long code.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...