Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Other » PHP issue
Re: PHP issue [message #440909 is a reply to message #438943] Mon, 06 December 2010 09:13 Go to previous messageGo to previous message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma:
General (1 Star)
Back here again...
I started working on making mysql query's more efficient as they seem to suck at the moment but that is another story.

To put it bluntly I am obviously missing some function that I do not know about.
I have a delete button for a comment (which is inputted by a user), the thing is these comments are echoed with an array, and I do not know how to pinpoint each number from the array to each comment.
page1.php
$commentquery = mysql_query("SELECT * FROM comments WHERE reciptent = '".$id."'ORDER BY TIMESTAMP DESC");
while($get_comment_array = mysql_fetch_array($commentquery))
{
$sender = $get_comment_array['sender'];
$senderid = mysql_query("SELECT * FROM members WHERE uid = '".$sender."'");
$memberarray = mysql_fetch_array($senderid);
$sendername = $memberarray['fullname'];
$_SESSION['cid'] = $get_comment_array['commentid'];
$recepitent = $get_comment_array['reciptent'];
$message = $get_comment_array['message'];
$timeofwriting = $get_comment_array['TIMESTAMP'];
	echo "<div class='comments'>";	
	echo "<a style='color:blue;text-decoration:underline;' href='profile.php?id=".$sender."'>".$sendername."</a>" . " ". $message ." <a style='float:right' href='comment.php?type=member&action=del'><img src='delmessage.jpg'/></a>"."<span style='font-size:12px;color:grey;'>".$timeofwriting. . "</span>";
	echo "</div>";
}
echo "<div class='comments'>";
$_SESSION['tid'] = $id;
//$id == $_GET['id']

page2.php (this is the deleting page)
if($_GET['type'] == "member" && $_GET['action'] == "del")
{
	mysql_select_db("user");
$cid = $_SESSION['cid'];
$delquery = mysql_query("DELETE FROM comments where commentid = '".$cid."' AND  sender = '".$uid."'OR reciptent = '".$uid."'")or die(mysql_error());	
header("Location: page1.php?id=".$tid."");
}

[Updated on: Mon, 06 December 2010 09:14]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GameSpy
Next Topic: Generals... AGAIN
Goto Forum:
  


Current Time: Fri Nov 22 19:43:50 MST 2024

Total time taken to generate the page: 0.01054 seconds