Jump to content

Cant figure out what how to get rid of warnings


rain13

Recommended Posts

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/np10124/domains/autoit.net.ee/public_html/2010/post.php on line 297Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/np10124/domains/autoit.net.ee/public_html/2010/post.php on line 299
I cant find out how to get rid of those 2 warnings.As I understood warnings are caused by
$comments = mysql_result($result,0,"Comment");if ($All){return $comments;}$Title = mysql_result($result,0,"FileName");

but I cant set row other than 0 because then I woulnt get any result at allI also noticed that if I cal that preview from script directly I wont get those errors but when I hit preview button on js editor, I have that error.

<?phpecho'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><style TYPE="text/css">blockquote {	background: #EBEADD none 6px 8px no-repeat;	border-color:#DBDBCE;	font-size: 0.95em;	margin: 0.5em 1px 0 25px;	overflow: hidden;	padding: 5px;}a:link	{ color: #0000CC; text-decoration: none; }a:visited	{ color: #0000CC; text-decoration: none; }a:hover	{ color: #3333FF; text-decoration: underline; }a:active	{ color: #3333FF; text-decoration: none; }.postprofile {	margin: 5px 0 10px 0;	min-height: 80px;	color: #00;	border-left: 1px solid #000000;	width: 22%;	float: right;	display: inline;}.postbody {	padding: 0;	line-height: 1.48em;	color: #333333;	width: 76%;	float: left;	clear: both;}hr.divider {	float: none;	display: none;}/* Poster profile icons----------------------------------------*//* Rollover state */ul.profile-icons li {	float: left;	margin: 0 6px 3px 0;	background-position: 0 100%;}/* Positioning of moderator icons */.postbody ul.profile-icons {	float: right;	width: auto;	padding: 0;}</style></head><body><div style="overflow:auto;">';//~ die($_POST['Editor']);//~ $a = '<b>\"double\"</b>'."\'single\'";//~ die($a);//~ $a = '<b>\"double\"</b>'."\'single\'";//~ $a = str_replace("\'","'",$a); //remove slashes//~ $a = str_replace('\"','"',$a);//~ $a = htmlspecialchars($a,ENT_QUOTES);//~ die($a."\n");function GropuToString($GroupNR){	if ($GroupNR == 0){return "Banned";}	elseif ($GroupNR == 1){return "Registered user";}	elseif ($GroupNR == 2){return "Administrator";}}$MyGroup = 0;$singleQuete = "'";$dbuser="***";$dbpassword="***";$database="****";$tblName = "Users";mysql_connect("localhost",$dbuser,$dbpassword);@mysql_select_db($database) or die( "Unable to select database");$loggedin = false;if(isset($_COOKIE['User'])){	//echo($_COOKIE['User']);	//exit();	$UserData = explode("waaaaaaaaaaaaw",$_COOKIE['User']);	//echo "cookie".$UserData;	$result = mysql_query("SELECT * FROM ".$tblName.' WHERE UserName = "'.$UserData[0].'"');	if(mysql_num_rows($result)){		if ($UserData[1] == mysql_result($result,0,"UserPassword"))		{			$MyGroup = mysql_result($result,0,"UserGroup");			if(mysql_result($result,0,"UserGroup") == 0){echo("<p>Your account have been banned!<br>Reason: ".mysql_result($result,0,"UserBanReason")."</p>"); $loggedin  = false;}			else{$loggedin  = true;}		}	}else{		setcookie("User", "", mktime(12,0,0,1, 1, 1990));	}}$Action = $_GET["a"];$TopicNR = $_GET["t"];$FileName = $_GET["f"];if	(strlen($Action) >=1 && strlen($TopicNR) >=1 && strlen($FileName) >=1){	$body = GetCommentInfo(GetCommentByNameAndID($FileName,$TopicNR));	CheckPermission();	switch ($Action) {		case "edit2":			CheckPermission($body[0],true);			$NewComment = substr(file_get_contents("php://input"),7);			$NewComment = str_replace("\'","'",$NewComment); //remove slashes			$NewComment = str_replace('\"','"',$NewComment);			$NewComment = htmlspecialchars($NewComment,ENT_QUOTES);			$NewComment = str_replace("\n","<br>",$NewComment); //New line			$NewComment = str_replace("\r","",$NewComment);			$NewComment = str_replace($body[4],$NewComment,GetCommentByNameAndID($FileName,-1,true));			SetCommentByName($FileName,$NewComment);			die("Topic successfully edited<br>".'<meta http-equiv="Refresh" content="3;url=./post.php"/>');		case "edit":			CheckPermission($body[0],true);			echo str_replace('xmlhttp.open("POST","post.php?a=edit2&t=0&f=0",true); //ToServer','xmlhttp.open("POST","post.php?a=edit2&t='.$TopicNR.'&f='.$FileName.'",true); //ToServer',str_replace('var ContentStr = DisHex("");','var ContentStr = DisHex("'.strToHex($body[4]).'");',FileRead("./ajaxpost.html")));			exit();		case "delete2":			CheckPermission($body[0],true);			die(str_replace(GetCommentByNameAndID($FileName,$TopicNR)."[/comment]","",GetCommentByNameAndID($FileName,-1,true)));		case "delete":			CheckPermission($body[0],true);			$deletestr = '<b>Are you sure you want to delete this post?</b>			<form name="report" action="post.php?a=delete2&t='.$TopicNR."&f=".$FileName.'" method="post">			<input type="submit" value="Delete comment"> OR<a href="./post.php" color="red"><b><span style="color: rgb(200, 0, 10);">Cancel</span></b></a>			</form>			';			die($deletestr."<br><br><h2>Comment:</h2>".parsecode($body[4],true));		case "report2":			CheckPermission($body[0],false);			if(strlen($_POST["reason"]) >= 1){die ('Comment sucessfully reported for '.$_POST["reason"].'!<br>Click <a href="./post.php">here</a> to go back.');}			die("Invalid selection");		case "report":			CheckPermission($body[0],false);			$reportstr = '<b>Report comment</b>			<form name="report" action="post.php?a=report2&t='.$TopicNR."&f=".$FileName.'" method="post">			<input type="radio" name="reason" value="foul language">Foul language<br>			<input type="radio" name="reason" value="inappropriate content">Inappropriate comment<br>			<input type="radio" name="reason" value="harassment">Harassment<br>			<input type="radio" name="reason" value="links to illegal or pirated softwar">Links to illegal or pirated software<br>			<input type="radio" name="reason" value="links to scamming site or viruses or keyloggers or other unwanted software">Links to scamming site or viruses or keyloggers or other unwanted software<br>			<input type="radio" name="reason" value="having a commercial purpose">Comment has commercial purpose			<br>			<input type="submit" value="Report"> OR<a href="./post.php" color="red"><b><span style="color: rgb(200, 0, 10);">Cancel</span></b></a>			</form>			';			if ($body[3] == "true"){				die("This topic is already reported");			}else{				die($reportstr."<br><br><h2>Comment:</h2>".parsecode($body[4],true));			}			exit();		case "quote":			CheckPermission($body[0],false);			echo str_replace('var ContentStr = DisHex("");','var ContentStr = DisHex("'.strToHex("[quote]".$body[4]."[/quote]").'");',FileRead("./ajaxpost.html"));			exit();		case "reply":			CheckPermission($body[0],false);			echo str_replace('var ContentStr = DisHex("");','var ContentStr = DisHex("'.strToHex($body[4]).'");',FileRead("./ajaxpost.html"));			exit();		case "info":			CheckPermission($body[0],true);			$InfoString ='				<table border="0">					<tr>						<td>Owner:</td>						<td>%owner</td>					</tr>					<tr>						<td>Created:</td>						<td>%date</td>					</tr>					<tr>						<td>IP:</td>						<td>%ip</td>					</tr>					<tr>						<td>Reported:</td>						<td>%reported</td>					</tr>				</table>				';			$InfoString = str_replace("%owner",$body[0],$InfoString);			$InfoString = str_replace("%date",$body[1],$InfoString);			$InfoString = str_replace("%ip",$body[2],$InfoString);			$InfoString = str_replace("%reported",$body[3],$InfoString);			echo "<h2>Comment info</h2><br>".$InfoString."<br><h2>Preview:</h2>".parsecode($body[4],true);			exit();		case "preview":			$PreviewData = substr(file_get_contents("php://input"),7);			//~ die("Raw:".$PreviewData);			$PreviewData = str_replace("\'","'",$PreviewData); //remove slashes			$PreviewData = str_replace('\"','"',$PreviewData);			$PreviewData = htmlspecialchars($PreviewData,ENT_QUOTES);			echo('<h3>Preview:</h3><div style="border: 1px solid;width:76%;">'.parsecode($PreviewData, true).'</div>');			exit();	}}function ArrayDisplay($array){$str = "";for	($i = 0;$i < count($array);$i++){$str.='<tr><td>['.$i.']</td><td>'.$array[$i].'</td></tr>';}$tbl = '<table border="1"><tr><td>Elements</td><td>'.count($array).'</td></tr>'.$str.'</table>';die($tbl);}function CheckPermission($Owner = "",$RequireAdmin = false){	global $loggedin;	global $UserData;	global $MyGroup;	if (strlen($Owner) >= 1){		if ($loggedin == false){die("<br>You are not allowed to use this feature");}		if($Owner != $UserData[0] && $RequireAdmin && $MyGroup != 2){die("You are not owner of this topic!");}	}else{		if ($loggedin == false){die("<br>You are not allowed to use this feature");}	}}function strToHex($string){	$hex='';	for ($i=0; $i < strlen($string); $i++)	{		$hex .= dechex(ord($string[$i]));	}	return $hex;}function GetCommentInfo($Code){	//~ die("GetCommentInfo: ".$Code);	$UserName = substr($Code,15);	$UserEnd = strpos($UserName,'"');	$UserName = substr($UserName,0,$UserEnd );	$DateStart = strpos($Code,'date="');	$PostDate = substr($Code, $DateStart+6 );	$DateEnd = strpos($PostDate,'"');	$PostDate = substr($PostDate, 0 ,$DateEnd);	$IPStart = strpos($Code,'IP="');	$PostIP = substr($Code, $IPStart+4 );	$IPEnd = strpos($PostIP,'"');	$PostIP = substr($PostIP, 0 ,$IPEnd);	$IsReportedStart = strpos($Code,'IsReported="');	$PostIsReported = substr($Code, $IsReportedStart+12 );	$IsReportedEnd = strpos($PostIsReported,'"');	$PostIsReported = substr($PostIsReported, 0 ,$IsReportedEnd);	$ReportedString = "";	if ($PostIsReported == "true"){$ReportedString = ' <font color="#ff0000">[REPORTED]</font>';}	$TextStart= $IsReportedStart+12+$IsReportedEnd+2;	$Code = substr($Code , $TextStart);	$array[0] = $UserName;	$array[1] = $PostDate;	$array[2] = $PostIP;	$array[3] = $PostIsReported;	$array[4] = $Code;	return $array;}function GetCommentByNameAndID($name,$id,$All = false){	if ($name != "" && $id != ""){		@mysql_select_db("Images");		$result = mysql_query("SELECT * FROM ".'Images WHERE FileName = "'.$name.'"');		$comments = mysql_result($result,0,"Comment");		if ($All){return $comments;}		$Title = mysql_result($result,0,"FileName");		if ($comments == ""){return "No one comments";}		else		{			$CommentsArray = explode("[/comment]",$comments);			//ArrayDisplay($CommentsArray);			return $CommentsArray[$id];		}	}}function SetCommentByName($name,$comment){	if ($name != "" && $comment != ""){		@mysql_select_db("Images");		//~ $result = mysql_query("SELECT * FROM ".'Images WHERE FileName = "'.$name.'"');		mysql_query("UPDATE Images SET Comment = '".$comment."' WHERE FileName = '".$name."'");	}else{	die("comment can not be empty<br>".$comment);	}}function FileWrite($sFile,$sString){if (strlen($sString) > 0){	$hFile = fopen($sFile, 'a');	if	($hFile){		fwrite($hFile, $sString);		fclose($hFile);		return true;	}}return false;}//~ if (strlen($a) >= 1){echo '<h3>Preview:</h3><div style="border:1px solid grey;">'.parsecode($a, true)."</div>";exit();}function FileRead($sFile){	$fd = fopen ($sFile , "r");	if ($fd) {		if (filesize($sFile) > 0){			$fstring = fread ($fd , filesize ($sFile));			fclose($fd);			return $fstring;		}else{			fclose($fd);			return "";			}	}	else{		echo '<font color="#FF0000">ERROR:</font> Can not read file '.$sFile;		return false;	}}function parsecode($Code, $preview = false, $TopicNR = 0, $FileName = ""){	global $database;	global $tblName;	global $UserData;	global $Title;	global $loggedin;	global $MyGroup;	$LnkEdit = '<a href="'.$_SERVER["SCRIPT_NAME"].'?a=edit&t='.$TopicNR."&f=".$FileName.'">Edit</a>';	$LnkDelete = '<a href="'.$_SERVER["SCRIPT_NAME"].'?a=delete&t='.$TopicNR."&f=".$FileName.'">Delete</a>';	$LnkReport = '<a href="'.$_SERVER["SCRIPT_NAME"].'?a=report&t='.$TopicNR."&f=".$FileName.'">Report abuse</a>';	$LnkQuote = '<a href="'.$_SERVER["SCRIPT_NAME"].'?a=quote&t='.$TopicNR."&f=".$FileName.'">Quote</a>';	$LnkReply = '<a href="'.$_SERVER["SCRIPT_NAME"].'?a=reply&t='.$TopicNR."&f=".$FileName.'">Post reply</a>';	$LnkInfo = '<a href="'.$_SERVER["SCRIPT_NAME"].'?a=info&t='.$TopicNR."&f=".$FileName.'">Info</a>';	if ($preview == false){	$UserName = substr($Code,15);	$UserEnd = strpos($UserName,'"');	$UserName = substr($UserName,0,$UserEnd );	$DateStart = strpos($Code,'date="');	$PostDate = substr($Code, $DateStart+6 );	$DateEnd = strpos($PostDate,'"');	$PostDate = substr($PostDate, 0 ,$DateEnd);	$IPStart = strpos($Code,'IP="');	$PostIP = substr($Code, $IPStart+4 );	$IPEnd = strpos($PostIP,'"');	$PostIP = substr($PostIP, 0 ,$IPEnd);	$IsReportedStart = strpos($Code,'IsReported="');	$PostIsReported = substr($Code, $IsReportedStart+12 );	$IsReportedEnd = strpos($PostIsReported,'"');	$PostIsReported = substr($PostIsReported, 0 ,$IsReportedEnd);	$ReportedString = "";	if ($PostIsReported == "true"){$ReportedString = ' <font color="#ff0000">[REPORTED]</font>';}	$TextStart= $IsReportedStart+12+$IsReportedEnd+2;	$Code = substr($Code , $TextStart);	}	$bbarray = array("[b]","[/b]","[i]","[/i]","[u]","[/u]","[quote]","[/quote]");	$htmlarray = array("<b>","</b>","<i>","</i>","<u>","</u>","<blockquote>","</blockquote>");	$Code = str_replace($bbarray,$htmlarray,$Code);		while (preg_match_all('`\[(.+?)=?(.*?)\](.+?)\[/\1\]`', $Code, $matches)) foreach ($matches[0] as $key => $match) {			list($tag, $param, $innertext) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]);			switch ($tag) {				case 'size': $replacement = "<span style=\"font-size: $param;\">$innertext</span>"; break;				case 'color': $replacement = "<span style=\"color: $param;\">$innertext</span>"; break;				case 'center': $replacement = "<div class=\"centered\">$innertext</div>"; break;				case 'lnk': $replacement = '<a href="' . ($param? $param : $innertext) . "\">$innertext</a>"; break;				case 'url': $replacement = '<a href="' . ($param? $param : $innertext) . "\">$innertext</a>"; break;				case 'img':					list($width, $height) = preg_split('`[Xx]`', $param);					$replacement = "<img src=\"$innertext\" " . (is_numeric($width)? "width=\"$width\" " : '') . (is_numeric($height)? "height=\"$height\" " : '') . '/>';				break;				case 'video':					$videourl = parse_url($innertext);					parse_str($videourl['query'], $videoquery);					if (strpos($videourl['host'], 'youtube.com') !== FALSE) $replacement = '<embed src="http://www.youtube.com/v/' . $videoquery['v'] . '" type="application/x-shockwave-flash" width="425" height="344"></embed>';					if (strpos($videourl['host'], 'google.com') !== FALSE) $replacement = '<embed src="http://video.google.com/googleplayer.swf?docid=' . $videoquery['docid'] . '" width="400" height="326" type="application/x-shockwave-flash"></embed>';				break;			}			$Code = str_replace($match, $replacement, $Code);		}	$Code = str_replace("\n", "<br>", $Code);	$array[0] = $UserName;	$array[1] = $PostDate;	$array[2] = $Code;	$Buttons = "";	if ($loggedin)	{		if($PostIsReported == "true"){$LnkReport = "";}		$Buttons.= $LnkReport." ".$LnkQuote." ".$LnkReply;		if ($UserName == $UserData[0] || $MyGroup == 2){			$Buttons.= " ".$LnkEdit." ".$LnkDelete;		}		//~ die("Group: ".$Group);		if ($MyGroup == 2){$Buttons.= " ".$LnkInfo;}	}	if	(!$preview){$PosstString='<div class="postbody" style="background-color:#%topiccolor" >	<ul class="profile-icons">		'.$Buttons.'	</ul>	<h3>%title'.$ReportedString.'</h3>	Posted by %user on %postdate	<div>%text</div></div><dl class="postprofile">	<dd style="margin: 0px 5px 0px 5px">%user<br> %group<br>%usravatar<br> Posts: %uposts<br> Joined: %joindate<br>MSN: %usrmsn<br>Email: %usrmail</dd></dl><hr class="divider" />';}else{	$PosstString='%text';	$PosstString = str_replace("%text",$array[2],$PosstString);	return $PosstString;	}	@mysql_select_db($database);	$result = mysql_query("SELECT * FROM ".$tblName.' WHERE UserName = "'.$UserName.'"');	$Group = mysql_result($result,0,"UserGroup");	$PostCount = mysql_result($result,0,"UserPostCount");	$Joindate = mysql_result($result,0,"UserJoinDate");	$UserAvatar = mysql_result($result,0,"UserAvatar");	if ($UserAvatar != ""){$UserAvatar = '<img src="'.$UserAvatar .'" alt="Not found"/>';}	$showemail = '';	$showmsn = '';	$showState = mysql_result($result,0,'UserShowMailMSN');	if	($showState == 3){$showemail = mysql_result($result,0,'UserEmail'); $showmsn = mysql_result($result,0,'UserMSN');}	elseif($showState == 2){$showmsn = mysql_result($result,0,'UserMSN');}	elseif($showState == 1){$showemail = mysql_result($result,0,'UserEmail');}	$showemail = str_replace("@","(at)",$showemail);	$showemail = str_replace(".","(dot)",$showemail);	$showmsn = str_replace("@","(at)",$showmsn);	$showmsn = str_replace(".","(dot)",$showmsn);	$PosstString = str_replace("%user",$array[0],$PosstString);	$PosstString = str_replace("%postdate",$array[1],$PosstString);	$PosstString = str_replace("%title",$Title,$PosstString);	$PosstString = str_replace("%group",GropuToString($Group),$PosstString);	$PosstString = str_replace("%uposts",$PostCount,$PosstString);	$PosstString = str_replace("%joindate",$Joindate,$PosstString);	$PosstString = str_replace("%usravatar",$UserAvatar,$PosstString);	$PosstString = str_replace("%usrmsn",$showmsn,$PosstString);	$PosstString = str_replace("%usrmail",$showemail,$PosstString);	$PosstString = str_replace("%text",$array[2],$PosstString);	return $PosstString."\n<!-- COMMENT END -->\n\n";}@mysql_select_db("Images");$result = mysql_query("SELECT * FROM ".'Images WHERE FileName = "file"');$comments = mysql_result($result,0,"Comment");$Title = mysql_result($result,0,"FileName");if ($comments == ""){echo "No one comments";}else{	$CommentsArray = explode("[/comment]",$comments);	$ColorToggle = true;	for ($i = 0; $i < count($CommentsArray) -1;$i++)	{		if ($ColorToggle){			$TopicColor = "f0f0f0";			$ColorToggle = false;		}else		{			$TopicColor = "ffffff";			$ColorToggle = true;		}		$PosstString  = ParseCode($CommentsArray[$i],false,$i,$Title);		$PosstString = str_replace("%topiccolor",$TopicColor,$PosstString);		echo $PosstString."<br>";	}}echo '</div>  <!-- closes the div with overflow:auto --><p style="float: none;">';if ($loggedin){echo '<br>'.FileRead("./ajaxpost.html").'<p>';}else{echo "<br>Login to reply";}echo '<body><html>';?>

Java Script

<html><head><title>PHP using AJAX</title><script type="text/javascript">var time_variable;function getval(){return "abc";}function getXMLObject()  //XML OBJECT{   var xmlHttp = false;   try {	 xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers   }   catch (e) {	 try {	   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+	 }	 catch (e2) {	   xmlHttp = false   // No Browser accepts the XMLHTTP Object then false	 }   }   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {	 xmlHttp = new XMLHttpRequest();		//For Mozilla, Opera Browsers   }   return xmlHttp;  // Mandatory Statement returning the ajax object created}var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax objectfunction ajaxFunction() {  var getdate = new Date();  //Used to prevent caching during ajax call  if(xmlhttp) {	  var txtname = document.getElementById("Editor");	xmlhttp.open("POST","post.php?a=preview&t=0&f=0",true); //calling testing.php using POST method	xmlhttp.onreadystatechange  = handleServerResponse;	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xmlhttp.send("Editor=" + txtname.value); //Posting txtname to PHP File  }}function post() {  var getdate = new Date();  //Used to prevent caching during ajax call  if(xmlhttp) {	  var txtname = document.getElementById("Editor");	xmlhttp.open("POST","post.php?a=edit2&t=0&f=0",true); //ToServer	xmlhttp.onreadystatechange  = handleServerResponse;	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xmlhttp.send("Editor=" + txtname.value); //Posting txtname to PHP File  }}function handleServerResponse() {   if (xmlhttp.readyState == 4) {	 if(xmlhttp.status == 200) {		if (xmlhttp.responseText.indexOf('Topic successfully edited<br><meta http-equiv="Refresh" content="3;url=./post.php"/>') > -1){window.location = "./post.php";}	   document.getElementById("message").innerHTML=xmlhttp.responseText; //Update the HTML Form element	 }	 else {		alert("Error during AJAX call. Please try again");	 }   }}function set(style) {	var StyleStart = "["+style+"]";	var StyleEnd = "[/"+style+"]";	if (style == "youtube")	{		var StyleStart = "[video host=youtube.com]";		var StyleEnd = "[/video]";	}	if (style == "google")	{		var StyleStart = "[video host=google.com]";		var StyleEnd = "[/video]";	}   var ta = document.getElementById("Editor");   if (document.selection) {	  str = document.selection.createRange().text	  document.selection.createRange().text = StyleStart + str + StyleEnd;	  return true;   }   else if (ta.selectionStart) {	  var startPos = ta.selectionStart;	  var endPos = ta.selectionEnd;	  var str = ta.value.substring(startPos, endPos);	  ta.value = ta.value.substring(0, startPos) + StyleStart + str + StyleEnd + ta.value.substring(endPos, ta.value.length);	  return true;   }   else {	  var startPos = ta.selectionStart;	  var endPos = ta.selectionEnd;	  var str = ta.value.substring(startPos, endPos);	  ta.value = ta.value.substring(0, startPos) + StyleStart + str + StyleEnd + ta.value.substring(endPos, ta.value.length);	  return true;   }}function DisHex(str){	var r='';	for(var i=0;i<str.length;i+=2)	{		r+=unescape('%'+str.substr(i,2));	}	return r;}</script><div id="message" name="message"></div><br><input type="button" value="bold" onclick="set('b')" /> <input type="button" value="Italic" onclick="set('i')" /> <input type="button" value="Underline" onclick="set('u')" /> <input type="button" value="Image" onclick="set('img')" /> <input type="button" value="Link" onclick="set('lnk')" /> <input type="button" value="Quote" onclick="set('quote')" /> <input type="button" value="Youtube" onclick="set('youtube')" /> <input type="button" value="Google video" onclick="set('google')" /><br /><textarea id="Editor" style="height:300px; width:76%"></textarea><br><script type="text/javascript">var txtArea = document.getElementById('Editor');var ContentStr = DisHex("");replaced = ContentStr.replace(/<br>/g, "\n");txtArea.value = replaced;</script><input type="button" value="Preview" onclick="ajaxFunction()" /><input type="button" value="Submit" onclick="post()" />

Link to comment
Share on other sites

Try assigning your query string to a variable and passing the variable to mysql_query. Before you do that, echo the query string as a test. See if it looks the way it should.Try adding something like this before you call mysql_num_rows :

if (!$result) {	die mysql_error();}

Try changing this: if(mysql_num_rows($result)){to this: if(mysql_num_rows($result) > 0){Try using mysql_fetch_assoc instead of repeatedly calling mysql_result.

Link to comment
Share on other sites

Try assigning your query string to a variable and passing the variable to mysql_query. Before you do that, echo the query string as a test. See if it looks the way it should.Try adding something like this before you call mysql_num_rows :
if (!$result) {	die mysql_error();}

Try changing this: if(mysql_num_rows($result)){to this: if(mysql_num_rows($result) > 0){Try using mysql_fetch_assoc instead of repeatedly calling mysql_result.

You talk about line 100, but errors are with line 297 and 299
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/np10124/domains/autoit.net.ee/public_html/2010/post.php on line 297Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 4 in /home/np10124/domains/autoit.net.ee/public_html/2010/post.php on line 299
also adding if (!$result) {die (mysql_error());} doesnt display any errorsLines 293 to 310
function GetCommentByNameAndID($name,$id,$All = false){	if ($name != "" && $id != ""){		@mysql_select_db("Images");		$result = mysql_query("SELECT * FROM ".'Images WHERE FileName = "'.$name.'"');		if (!$result) {die (mysql_error());}		$comments = mysql_result($result,0,"Comment");		if ($All){return $comments;}		$Title = mysql_result($result,0,"FileName");		if ($comments == ""){return "No one comments";}		else		{			$CommentsArray = explode("[/comment]",$comments);			//ArrayDisplay($CommentsArray);			return $CommentsArray[$id];		}	}}

And why do I only get those warnings when I hit preview button from my editor? Why I dont get any errors when I just load that page or when I click links Report abuse Quote Post reply Edit Delete Info I also dont get this error. I ONLY get it when I hit preview from my editor.Editor: http://autoit.net.ee/2010/ajaxpost.html

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...